[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: hook for buffer creation
From: |
Lowell Gilbert |
Subject: |
Re: hook for buffer creation |
Date: |
Tue, 04 May 2010 15:42:32 -0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1 (berkeley-unix) |
Francis Moreau <francis.moro@gmail.com> writes:
> On Mar 15, 3:40 pm, Lowell Gilbert <lguse...@be-well.ilk.org> wrote:
>> Francis Moreau <francis.m...@gmail.com> writes:
>> > 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 ?
>>
>> This is a kind of strange request. There are several options in the
>> "Standard Hooks" node of the elisp manual (Appendix 1). If the buffers
>> will always have files attached, I'd suggest find-file-hook. Otherwise,
>> something related to local variables will probably get executed at the
>> right time.
>
> This is a kind of a strange answer :)
Yes, I suppose so. I just can't imagine wanting to apply the same
highlighting to all my buffers, including the minibuffer, *Help*,
and so on.
> So there's no hook for buffer creation if the new buffer is not
> attached to a file ?
I didn't know for sure, so I pointed you in the direction of the
documentation you might find useful. I've checked now, though,
and I don't *think* there's a hook for that. switch-to-buffer is
defined in C code, so it's not as easy to look up as Lisp
functions. You still might want to check the manual item I
suggested, as there are other options I didn't mention.
Putting on my psychic tech-support hat, on the other hand, I'm
going to guess that faced with whatever you're really trying to
do, I'd probably write a minor mode to do the highlighting and use
normal hooks to apply it as appropriate.