[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: org-mode and mode hooks.

From: Luc Teirlinck
Subject: Re: org-mode and mode hooks.
Date: Sun, 29 May 2005 22:35:09 -0500 (CDT)

Maybe I could still use MODE-stored-mode as a define-global-minor-mode
internal variable for efficiency reasons (unless it is easy to
recognize whether we are running from a process or timer, in which
case it is not necessary).  That way, we are checking whether
_after-change-major-mode-hook_ got the major mode correct.  If it did,
nothing could have messed it up later, since we are already in the
final mode.  Thus, post-command-hook does not need to dis- and
re-enable the minor mode.  This is what will happen in the vast
majority of the cases.  Otherwise, we dis- and re-enable.

The trouble with doing that for Font Lock, given its current code, is
what happens if after-change-major-mode never ran Font Lock, and Font
Lock is nevertheless enabled.  Then it was set by something else.
Without help from Font Lock itself, we can not know whether that was for
the correct major mode or not.  This will happen infrequently enough
that we do not need to worry about a small and unlikely inefficiency
here.  However, the trouble with the current Font Lock code is that
trying to correct the major mode is a last resort desperation measure
that may not work reliably, so we must be completely sure that it is
really necessary.  For Font Lock, we are not talking about a small
inefficiency, but about real trouble.  That would no longer be the
case if dis- and re-enabling Font Lock reliably adapted it for the
current mode.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]