From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Mauger Newsgroups: gmane.emacs.devel Subject: Re: org-mode and mode hooks. Date: Fri, 27 May 2005 14:49:37 +0000 (UTC) Message-ID: References: <87y8a3mnz8.fsf@xs4all.nl> <87ll63weye.fsf-monnier+emacs@gnu.org> <200505252135.j4PLZvt26969@raven.dms.auburn.edu> <87hdgrufcl.fsf-monnier+emacs@gnu.org> <200505260359.j4Q3xbj28809@raven.dms.auburn.edu> <87is16rsid.fsf-monnier+emacs@gnu.org> <200505261501.j4QF17h00246@raven.dms.auburn.edu> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1117205902 16501 80.91.229.2 (27 May 2005 14:58:22 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 27 May 2005 14:58:22 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri May 27 16:58:21 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DbgFG-0002QO-8v for ged-emacs-devel@m.gmane.org; Fri, 27 May 2005 16:55:31 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DbgJY-0006dC-7M for ged-emacs-devel@m.gmane.org; Fri, 27 May 2005 10:59:56 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DbgIz-0006bz-P5 for emacs-devel@gnu.org; Fri, 27 May 2005 10:59:21 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DbgIw-0006aK-Ig for emacs-devel@gnu.org; Fri, 27 May 2005 10:59:18 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DbgIw-0006a6-7B for emacs-devel@gnu.org; Fri, 27 May 2005 10:59:18 -0400 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtp (TLS-1.0:RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1DbgHH-0005HS-VS for emacs-devel@gnu.org; Fri, 27 May 2005 10:57:36 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1DbgBy-0001fy-T7 for emacs-devel@gnu.org; Fri, 27 May 2005 16:52:09 +0200 Original-Received: from 158.171.31.18 ([158.171.31.18]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 27 May 2005 16:52:06 +0200 Original-Received: from mmaug by 158.171.31.18 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 27 May 2005 16:52:06 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: emacs-devel@gnu.org Original-Lines: 42 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: main.gmane.org User-Agent: Loom/3.14 (http://gmane.org/) X-Loom-IP: 158.171.31.18 (Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; bkbrel07)) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:37778 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:37778 Luc Teirlinck dms.auburn.edu> writes: > > Stefan Monnier wrote: > > Can you explain the change? > I really don't like the > > (defun turn-on-font-lock-as-appropriate () > (let (font-lock-set-defaults) > (turn-on-font-lock-if-enabled))) > > since it may cause font-lock-keywords to be reset from font-lock-defaults, > thus throwing away keywords added via font-lock-add-keywords since. > > The problem that binding font-lock-defaults to nil tries to solve is > that (with org-mode's yesterday's version), after font-lock was turned > on in outline-mode, I could not get it correct for org-mode by > disabling and enabling font-lock-mode, font-lock just kept using > outline-mode's font-lock settings. I've run into the same problem in sql-mode; the need to alter the font-lock rules after font-lock-mode has been enabled. My current solution is as follows: ;; Force font lock to reinitialize if it is already on ;; Otherwise, we can wait until it can be started. (when (and (fboundp 'font-lock-mode) (boundp 'font-lock-mode) font-lock-mode) (font-lock-defontify) (font-lock-mode -1) (font-lock-mode 1)) The `defontify' seems to be the ticket to get font-lock to recalc its settings and actually reperform the fontification. My original solution used internals from font-lock that were not version stable. Stefan, can you confirm that this approach should work? The docs for `font- lock-defontify' certainly imply that this function should do what we are looking for. Thanks. -- Michael