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

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

Re: switch-buffer-hook to catch the switch-event?


From: Stefan Monnier
Subject: Re: switch-buffer-hook to catch the switch-event?
Date: Mon, 25 Feb 2013 22:14:03 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

> How can I trigger an action everytime a certain buffer gets the focus
> (becomes current-buffer)? Is there no hook for 'switch-buffer' or
> something similar?

No, indeed, there isn't.  You can use window-configuration-change-hook
to detect changes within an Emacs frame, but in order to detect focus
changing from/to Emacs to/from other applications you'd additionally
need a focus-hook, but last I checked the corresponding C-level events
are not reliably propagated to Elisp.  Patch welcome.


        Stefan




reply via email to

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