help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why call font-lock-add-keywords in a mode hook?


From: Stefan Monnier
Subject: Re: Why call font-lock-add-keywords in a mode hook?
Date: Tue, 26 Jan 2016 08:04:16 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

>>> My question: why would I want to call this function in a hook if I can
>>> specify the mode in its invocation?
>> Because the other use is fundamentally unclean, requiring
>> a re-implementation of major-mode's inheritance, whereas you get it for
>> free if you use nil for `mode' and call it from the mode's hook instead.
> Ah, so that means that if I use a non-nil value for the `mode' argument,
> say x-mode, and launch a buffer in y-mode, which derives from x-mode,
> then I won't have my keywords there?

Yes (unless someone wrote the extra code to try and handle this case).


        Stefan



reply via email to

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