[Top][All Lists]

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

Re: hook for buffer creation

From: Stefan Monnier
Subject: Re: hook for buffer creation
Date: Wed, 05 May 2010 00:39:51 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

> I'd like to hilight some keywords for any buffers whatever the mode
> used for this buffer.  In order to achieve that I'd like to use the
> hook called when a buffer is created but I can't find it.  I only
> found the hook used when a buffer is killed.  Could anybody tell me
> the revelant hook to use ?

You can try `after-change-major-mode-hook', tho it's fairly recent and
will not always be run when you use code that hasn't been updated to
run it.

`change-major-mode-hook' is also an option (more reliable), but it's run
before changing major mode, so any buffer-local var you may modify from
it will be erased right after (it's typically used to turn off
a major-mode dependent minor mode).

You could also use define-globalized-minor-mode (which internally uses
the above): first define the highlighting you want as a buffer-local
minor-mode and then define a global version of it with


reply via email to

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