[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: Wed, 1 Jun 2005 17:42:11 -0500 (CDT)

   Can't remember.  IIRC there were problems where adding keywords to
   comint-mode didn't add them to all derivatives.

So you actually _want_ them added to derivatives.  That was not at all
obvious.  The actual patches I sent will add them to derivatives as
long as the mode conventions are followed.

But it you pass comint-mode as argument _in your .emacs_ (as
recommended in the docs), how will it enable them for derivatives?  I
have not read through every line of font-{lock,core}.el, so I may have
missed something, but `font-lock-set-defaults' does

    (cdr (assq major-mode font-lock-keywords-alist))

So if it contains (comint-mode . ...), it would appear to have no
effect in shell-mode.

So what is the difference between passing a non-nil MODE in your
.emacs or from a Lisp program?

In effect this is what the docstring of font-lock-keywords-alist says:

    Each element has the form (MODE KEYWORDS . APPEND).
    `font-lock-set-defaults' adds the elements in the list KEYWORDS to
    `font-lock-keywords' when Font Lock is turned on in major mode MODE.

It does not say "or in a derivative mode". 

So, instead of the current cryptic difference between .emacs and
programs, maybe the docstring should say to pass a non-nil MODE
argument if you do not want it to apply to derivatives and a nil one
if you do want it to apply to derivatives.  I believe that after such
doc fixes (which I could make) to the font-lock-{add,remove}-keyword
and the Elisp manual, my patches would do exactly what the revised docs
would say.

What happens to keywords in an _interactive_ mode change, that is
during kill-all-local-variables is a separate problem, not related to



reply via email to

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