all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: help-gnu-emacs@gnu.org
Subject: Re: hook for buffer creation
Date: Wed, 05 May 2010 00:39:51 -0400	[thread overview]
Message-ID: <jwvy6fzotkj.fsf-monnier+gnu.emacs.help@gnu.org> (raw)
In-Reply-To: c7376445-7f36-4747-8ef2-cada2d8b7fa3@z11g2000yqz.googlegroups.com

> 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
define-globalized-minor-mode.


        Stefan


      parent reply	other threads:[~2010-05-05  4:39 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
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 [this message]

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvy6fzotkj.fsf-monnier+gnu.emacs.help@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.