[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: hook for buffer creation
From: |
Colin S. Miller |
Subject: |
Re: hook for buffer creation |
Date: |
Tue, 04 May 2010 15:42:42 -0000 |
User-agent: |
Mozilla-Thunderbird 2.0.0.22 (X11/20090706) |
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. 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
--
Replace the obvious in my email address with the first three letters of the
hostname to reply.