From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Luc Teirlinck Newsgroups: gmane.emacs.devel Subject: Re: org-mode and mode hooks. Date: Thu, 26 May 2005 10:01:07 -0500 (CDT) Message-ID: <200505261501.j4QF17h00246@raven.dms.auburn.edu> 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> NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1117120156 28886 80.91.229.2 (26 May 2005 15:09:16 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 26 May 2005 15:09:16 +0000 (UTC) Cc: emacs-devel@gnu.org, Lute.Kamstra.lists@xs4all.nl, dominik@science.uva.nl Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu May 26 17:09:12 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DbJwb-0005Cn-Qp for ged-emacs-devel@m.gmane.org; Thu, 26 May 2005 17:06:46 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DbK0h-0008SP-22 for ged-emacs-devel@m.gmane.org; Thu, 26 May 2005 11:10:59 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DbJyn-0007Vi-5h for emacs-devel@gnu.org; Thu, 26 May 2005 11:09:01 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DbJyk-0007Tw-Ds for emacs-devel@gnu.org; Thu, 26 May 2005 11:08:58 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DbJyk-0007LR-3K for emacs-devel@gnu.org; Thu, 26 May 2005 11:08:58 -0400 Original-Received: from [131.204.53.104] (helo=manatee.dms.auburn.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DbJsA-00021o-Ey for emacs-devel@gnu.org; Thu, 26 May 2005 11:02:10 -0400 Original-Received: from raven.dms.auburn.edu (raven.dms.auburn.edu [131.204.53.29]) by manatee.dms.auburn.edu (8.12.10/8.12.10) with ESMTP id j4QF1TCK010289; Thu, 26 May 2005 10:01:29 -0500 (CDT) Original-Received: (from teirllm@localhost) by raven.dms.auburn.edu (8.11.7p1+Sun/8.11.7) id j4QF17h00246; Thu, 26 May 2005 10:01:07 -0500 (CDT) X-Authentication-Warning: raven.dms.auburn.edu: teirllm set sender to teirllm@dms.auburn.edu using -f Original-To: monnier@iro.umontreal.ca In-reply-to: <87is16rsid.fsf-monnier+emacs@gnu.org> (message from Stefan Monnier on Thu, 26 May 2005 10:08:13 -0400) 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:37708 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:37708 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. I believe that I want to make one change to my original patch, namely to add `check-buffers' rather than `buffes' to find-file-hook. So I will explain things using this additional change. 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. Note that some mode hooks (comint-mode-hook, for instance) enable font-lock by default. So it would seem that a mode derived from comint-mode in a non-standard way _already_ would have had org-mode type problems _before_ my patch to easy-mmode. `turn-on-font-lock-as-appropriate' would only be used by `define-global-minor-mode'. What I want to do is the following. When `after-change-major-mode' enables font-lock, it records what mode it did it for in easy-mmode-stored-mode. It does not remove any buffers from the list to check. When then either find-file-hook or post-command-hook run, they do remove buffers, but, if font-lock is already enabled, they first check easy-mmode-stored-mode. If it is non-nil and different from `major-mode', we know that after-change-major-mode ran to soon. (Maybe we should also print an error message in this case, which my current patch does not). We _must_ correct this. (I do not know how to do that without setting font-lock-defaults to nil.) If it is nil and font-lock is already enabled, we know that something else set font-lock, maybe a major mode body or a user hook. Here, we do not know whether or not it was set for the right mode. To be sure, we undo the setting anyway and do things over to be sure that it is set for the right mode. Sincerely, Luc.