From: "Colin S. Miller" <no-spam-thank-you@csmiller.demon.co.uk>
To: help-gnu-emacs@gnu.org
Subject: Re: hook for buffer creation
Date: Wed, 17 Mar 2010 22:24:13 +0000 [thread overview]
Message-ID: <4ba1562a$0$274$14726298@news.sunsite.dk> (raw)
In-Reply-To: <c7376445-7f36-4747-8ef2-cada2d8b7fa3@z11g2000yqz.googlegroups.com>
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.
next prev parent reply other threads:[~2010-03-17 22:24 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-13 17:44 hook for buffer creation Francis Moreau
2010-03-15 14:40 ` Lowell Gilbert
2010-03-15 20:37 ` Francis Moreau
2010-03-15 22:16 ` Lowell Gilbert
2010-03-17 22:24 ` Colin S. Miller [this message]
2010-03-20 18:45 ` Francis Moreau
2010-03-22 15:33 ` Stefan Monnier
2010-05-04 17:50 ` Dan Davison
[not found] ` <mailman.15.1272995469.29092.help-gnu-emacs@gnu.org>
2010-05-04 19:49 ` Colin S. Miller
2010-05-05 4:39 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='4ba1562a$0$274$14726298@news.sunsite.dk' \
--to=no-spam-thank-you@csmiller.demon.co.uk \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).