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: Wed, 1 Jun 2005 14:11:27 -0500 (CDT)

I still do not understand exactly what a nil argument for MODE in
font-lock-{add,remove}-keywords is supposed to accomplish.  The
font-lock-add-keywords docstring contains the following mysterious
sentence:

  When used from a Lisp program (such as a minor mode), it is recommended to
  use nil for mode (and place the call on a hook) to avoid subtle problems
  due to details of the implementation.

Which subtle problems?

It seems to me that a _global_ minor mode _should_ use a non-nil MODE
argument when adding or removing a keyword.  Do the "subtle problems"
refer to problems that occur when trying to make
font-lock-keywords-alist buffer local, as a buffer local minor mode
might be tempted to do?  A permanent buffer-local minor mode that
wants to add the keyword independent of the mode could use
after-change-major-mode-hook to add it.  With my latest set of patches
that will work for modes that run that hook.  If the minor mode wants
to add it for a particular mode and all its derived modes, it can,
after my patches, add it to the mode hook, as long as the mode and its
ancestor modes follow the new major mode conventions.  Only adding it
to a mode, but not to its derived modes, is problematic after my
patches, as well as without them.

Maybe one could have a font-lock-local-keywords-alist, that would be
_in addition_ to font-lock-keywords-alist.  That should be a
non-permanent local and could be used by non-permanent buffer local minor
modes.  If one is not willing to rely on after-change-major-mode-hook,
there could be a separate font-lock-permanent-local-keywords-alist,
for permanent-local minor modes.

All of this assuming that I am guessing the purpose of a nil argument
correctly.

Sincerely,

Luc.





reply via email to

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