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: Fri, 3 Jun 2005 09:59:58 -0500 (CDT)

Richard Stallman wrote:

       The only difference between the following patch to font-lock.el and
       the previous one are two doc fixes.  After those doc fixes, everything
       should work as documented when my three patches are applied.

   In that case, my previous comments about the previous patch
   still apply to this one.

There were many comments.  I tried to address the concrete ones to
easy-mmode in my latest patch for that file.  I explained why
define-derived-mode can not reliably record the major mode for which a
minor mode was enabled; if it is not supposed to be 100% reliable,
then define-global-major-mode can do just as good a job more easily.
My latest patches to define-global-major-mode do that job.

Other than that, the major remaining issue is that calling
font-lock-{add,remove}-keywords with nil for MODE only works reliably
for major modes that follow the new conventions.  But one of your
previous comments was:

         (Even in this case
       it is only likely to occur for major modes that do not follow the new
       conventions.)

   In that case, maybe it is a fine solution to tell people to fix their
   major modes.  Why go to a lot of trouble about broken major modes?

In addition to that, there would be a problem with major modes that do
follow the conventions but call font-lock-{add,remove}-keywords with
nil for MODE in their body instead of their hook.  Major modes are not
supposed to do that.  A nil argument was not designed to be used that
way and you said:

   I just looked for all the calls to font-lock-add-keywords in Emacs.
   In no case does any major mode call font-lock-add-keywords directly,
   or even fairly directly.  But it seems plausible to me that mode hook
   functions might call functions that call font-lock-add-keywords.
   Would that be a problem?

To answer the latter question: only for major modes that do not follow
the new conventions.  Even for them, there is no problem if the calls
were added by the user, because the old docs tell to pass a non-nil
argument for MODE and the problems only occur for a nil argument.  The
new docs say that it is OK for the user to pass a nil argument as long
as he realizes that it may not work reliably for non-conforming modes.

Problems remain with for minor modes that call
font-lock-{add,remove}-keywords with nil for MODE and add it to the
hook of a major mode that does not follow the conventions or has an
ancestor that does not.  Do you consider this to be a problem that
needs to be fixed before the next release?  Fixing it would require
non-trivial changes to Font Lock.

Sincerely,

Luc.





reply via email to

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