help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Buffer switching hook


From: Pascal J. Bourguignon
Subject: Re: Buffer switching hook
Date: Sat, 27 Apr 2013 15:26:25 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux)

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 {}.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]