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: Stefan Monnier
Subject: Re: org-mode and mode hooks.
Date: Wed, 01 Jun 2005 18:55:21 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

>    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.

Typically a derivative is a minor tweak and by default it should inherit
*all* characteristics of the parent mode.  This is not specific to font-lock.

> But it you pass comint-mode as argument _in your .emacs_ (as
> recommended in the docs), how will it enable them for derivatives?

Who said it will?  BTW, why did you underscore the "in your .emacs"?
Are you implying that things might be different elsewhere?

> 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.

And that's the problem.

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

I have no clue what your talking about w.r.t ".emacs vs Lisp program".

By placing the font-lock-add-keywords with a nil arg in the mode's hook, you
ensure that the font-lock-add-keywords is also run for derivatives.

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

Of course not: it's a property of major-mode-derivation, not of
font-lock keywords.

> 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.

That's pretty ugly, don't you think?  It's like saying "use this form to
benefit from quirk A or that form if you prefer quirk B".


        Stefan




reply via email to

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