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

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

Re: hook for buffer creation


From: Dan Davison
Subject: Re: hook for buffer creation
Date: Tue, 04 May 2010 13:50:40 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

"Colin S. Miller" <address@hidden> writes:

> Francis Moreau wrote:
>> Hello,
>>
>> 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 ?
>>
>> Thanks
>
> Francis,
>
> You could use   buffer-list-changed-hook.  It's called whenever
> a frame has its buffers modified.

Would change-major-mode-hook be another alternative? I've been trying to
use it recently with the aim of changing things in all buffers.

Dan


> You'd need to call (window-list) on
> that frame, and then get the buffer for each window. Then check if that
> buffer has yet to be processed by your hook
>
> If you want only the text-editing buffers, regardless of the major mode,
> then putting a defadvice on fundamental-mode (it doesn't have a hook),
> should work. IIRC, all text-edting modes are derived from fundamental-mode,
> and its hooks/init function are called.
>
> HTH,
> Colin S. Miller




reply via email to

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