emacs-devel
[Top][All Lists]
Advanced

[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 18:54:29 -0500 (CDT)

Richard Stallman wrote:

   I think I understand that.  But...

         In effect, we know of at least
       two examples of major modes that do this, comint-mode and
       interactive-sql-mode.

   This makes no sense to me.  I thought you were talking about minor
   modes and what they need to do.  Now you have switched to major modes.
   I cannot follow the change of subject.  Meanwhile, you have not
   finished the explanation.

To at least attempt to get things correctly with the current Font Lock
code, there are things the minor mode (Font Lock in this case) should
do, there are things that any major should do and there are things no
major mode should do.  Major modes should follow the conventions for
major modes rigorously.  But, in addition, they should not enable Font
Lock in any way, directly or indirectly (other than through the
define-global-minor-mode machinery), and they also should not call
font-lock-add-keywords directly or indirectly, even if this does not
enable Font Lock.  comint-mode and interactive-sql-mode both enable
Font Lock (the latter via sql-product-font-lock), creating problems
for modes derived from them.

   Anyway, how about if we change define-minor-mode so that it generates
   the code to record which major mode enabled it?

The very vast majority of minor modes have no reason whatsoever to do
this.

The problem is created by minor modes whose setup depends on the major
mode (I believe a small minority) and for whom dis- and re-enabling
the minor mode is not sufficient to correct a problem where the minor
mode is setup for the wrong mode.  The only known example (and
hopefully the only example, period) is Font Lock mode.

I will propose a new patch to easy-mmode that does _not_ use the new
variable MODE-stored-mode.  It will say that dis- and then re-enabling
the minor mode should correctly set up the minor mode for the current
major mode.  The only trouble with that is that this condition does
not apply to Font Lock.  Ideally one could make it apply.  Otherwise,
one could just use a variable internal to Font Lock.

Sincerely,

Luc.




reply via email to

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