From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Carsten Dominik Newsgroups: gmane.emacs.devel Subject: Re: org-mode and mode hooks. Date: Wed, 25 May 2005 17:49:47 +0200 Message-ID: <17044.40603.149086.810235@sam.science.uva.nl> References: <87y8a3mnz8.fsf@xs4all.nl> <17044.33688.784219.190965@sam.science.uva.nl> <873bsbmi4y.fsf@xs4all.nl> Reply-To: Carsten Dominik 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 1117036294 21213 80.91.229.2 (25 May 2005 15:51:34 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 25 May 2005 15:51:34 +0000 (UTC) Cc: emacs-devel@gnu.org, Carsten Dominik Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed May 25 17:51:24 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Day8t-00066H-UT for ged-emacs-devel@m.gmane.org; Wed, 25 May 2005 17:50:00 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DayCm-0002t7-VK for ged-emacs-devel@m.gmane.org; Wed, 25 May 2005 11:54:01 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DayCO-0002nK-3X for emacs-devel@gnu.org; Wed, 25 May 2005 11:53:36 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DayCL-0002lb-Ab for emacs-devel@gnu.org; Wed, 25 May 2005 11:53:33 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DayCL-0002ks-2J for emacs-devel@gnu.org; Wed, 25 May 2005 11:53:33 -0400 Original-Received: from [146.50.4.51] (helo=imap.science.uva.nl) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Day99-000332-Uo for emacs-devel@gnu.org; Wed, 25 May 2005 11:50:16 -0400 Original-Received: from sam.science.uva.nl [146.50.10.135] by imap.science.uva.nl with ESMTP (sendmail 8.11.6p2/config 11.35). id j4PFnlx17592; Wed, 25 May 2005 17:49:47 +0200 X-Organisation: Faculty of Science, University of Amsterdam, The Netherlands X-URL: http://www.science.uva.nl/ Original-Received: by sam.science.uva.nl (Postfix, from userid 11669) id 5640B17834; Wed, 25 May 2005 17:49:47 +0200 (CEST) Original-To: Lute Kamstra In-Reply-To: <873bsbmi4y.fsf@xs4all.nl> X-Mailer: VM 7.19 under Emacs 21.3.1 X-Virus-Scanned: by amavisd-new 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:37622 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:37622 Hi Lute, OK, I see now what the problem is, and I will switch to define-derived-mode, and to run-mode-hooks (for org-agenda-mode). This will indeed create a problem if someone uses outline-mode-hook to modify one of the three outline menus (Headings, Show, Hide). We will just have to see if anyone gets biten by this. I will implement the change tomorrow - need to do some testing first. - Carsten >>>>> "LK" == Lute Kamstra writes: LK> Hi Carsten, >> I remember trying to do define-derived mode, but not doing it for a >> number of reasons which I do not exactly remember. The argument was >> one reason. Another was that older versions of define-derived-mode >> did not allow a BODY arguments which I needed. >> A third one was that org-mode hacks away the Show and Hide menus of >> outline mode, and I did not want a mode hood to fail because is >> tries to add entries to non-existing menus. LK> With my patch, running outline-mode's mode hook (and LK> after-change-major-mode-hook) is delayed; it is run at the end of LK> org-mode. So it introduces the problem that a mode hook will fail LK> when it tries to change those menus. >> An important problem always is that I am writing code for Emacs and >> XEmacs, so my code needs to be compatible with both distributions. LK> AFAIK, XEmacs has delay-mode-hooks and run-mode-hooks as well. >> I did not know about delay-mode-hooks and run-mode-hooks - I'll check >> it out. >> >> What is actually the problem created by the current setup? What are >> you trying to do in the outline-mode-hook, and how does it interfer >> with what org-mode is doing? LK> My problem is not with outline-mode-hook but with LK> after-change-major-mode-hook. LK> In Emacs, global-font-lock-mode (and any other global minor mode LK> defined with define-global-minor-mode) adds one function to LK> change-major-mode-hook and a second function to LK> after-change-major-mode-hook to enable Font Lock mode. The first LK> functions adds the current buffer to a list variable. The second LK> function enables Font Lock mode for all buffers in that list and LK> clears the list. LK> change-major-mode-hook is run by kill-all-local-variables and LK> after-change-major-mode-hook is run by run-mode-hooks. So normally, a LK> major mode calls the first function once as the first thing it does LK> and the second function once as the last thing it does. However, LK> org-mode calls the second function halfway, before it sets up its own LK> Font-Lock stuff. As a result Font Lock doesn't work properly for LK> org-mode. LK> Lute. LK> PS. Putting the second function on after-change-major-mode-hook is a LK> recent change, it used to be on find-file-hook. -- Carsten Dominik \ _ / Sterrenkundig Instituut "Anton Pannekoek" |X| _ Kruislaan 403; NL-1098 SJ Amsterdam /| |\ _ _ _/ \ phone +31 (20) 525-7477; FAX +31 (20) 525-7484 __|o|___/ ~~ \___/ ~~~