From: "Pascal J. Bourguignon" <pjb@informatimago.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Buffer switching hook
Date: Sat, 27 Apr 2013 15:26:25 +0200 [thread overview]
Message-ID: <8738uc2jge.fsf@kuiper.lan.informatimago.com> (raw)
In-Reply-To: 517bc998$0$11599$862e30e2@ngroups.net
Miguel Guedes <miguel.a.guedes@gmail.com> writes:
> Hello List,
>
> I am writing a minor mode and as part of the requirements I need the
> minor-mode to be aware of when the user switches to a different buffer;
> something akin to `find-file-hook' but for buffers.
Your problem is probably ill-defined.
What do you mean by "user switches to a different buffer"?
There's a switch-to-buffer command, that you could advice, but it
probably is not all that you mean.
For example, the user could change the selected window or/and the
selected frame, and thus the current buffer, without switching to a
different buffer in any window.
> What is the best strategy to implement such a mechanism? I haven't really
> looked into `pre-command-hook' as I'd rather just use a hook, if one is
> available.
or post-command-hook. But since those hooks are run for each command,
including each character insertion, they must be very light.
--
__Pascal Bourguignon__ http://www.informatimago.com/
A bad day in () is better than a good day in {}.
next prev parent reply other threads:[~2013-04-27 13:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-27 12:50 Buffer switching hook Miguel Guedes
2013-04-27 13:26 ` Pascal J. Bourguignon [this message]
2013-04-29 8:48 ` Miguel Guedes
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=8738uc2jge.fsf@kuiper.lan.informatimago.com \
--to=pjb@informatimago.com \
--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).