[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: org-mode and mode hooks.
From: |
Lute Kamstra |
Subject: |
Re: org-mode and mode hooks. |
Date: |
Wed, 25 May 2005 17:37:17 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
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.
With my patch, running outline-mode's mode hook (and
after-change-major-mode-hook) is delayed; it is run at the end of
org-mode. So it introduces the problem that a mode hook will fail
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.
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?
My problem is not with outline-mode-hook but with
after-change-major-mode-hook.
In Emacs, global-font-lock-mode (and any other global minor mode
defined with define-global-minor-mode) adds one function to
change-major-mode-hook and a second function to
after-change-major-mode-hook to enable Font Lock mode. The first
functions adds the current buffer to a list variable. The second
function enables Font Lock mode for all buffers in that list and
clears the list.
change-major-mode-hook is run by kill-all-local-variables and
after-change-major-mode-hook is run by run-mode-hooks. So normally, a
major mode calls the first function once as the first thing it does
and the second function once as the last thing it does. However,
org-mode calls the second function halfway, before it sets up its own
Font-Lock stuff. As a result Font Lock doesn't work properly for
org-mode.
Lute.
PS. Putting the second function on after-change-major-mode-hook is a
recent change, it used to be on find-file-hook.
- Re: org-mode and mode hooks., (continued)
- Re: org-mode and mode hooks., Luc Teirlinck, 2005/05/27
- Re: org-mode and mode hooks., Richard Stallman, 2005/05/28
- Re: org-mode and mode hooks., Luc Teirlinck, 2005/05/28
- Re: org-mode and mode hooks., Richard Stallman, 2005/05/26
- Re: org-mode and mode hooks., Luc Teirlinck, 2005/05/26
- Re: org-mode and mode hooks., Luc Teirlinck, 2005/05/26
- Re: org-mode and mode hooks., Lute Kamstra, 2005/05/25
Message not available
Re: org-mode and mode hooks., Richard Stallman, 2005/05/26
Re: org-mode and mode hooks., Luc Teirlinck, 2005/05/28