[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: switch-buffer-hook to catch the switch-event?
From: |
Thorsten Jolitz |
Subject: |
Re: switch-buffer-hook to catch the switch-event? |
Date: |
Tue, 26 Feb 2013 05:23:16 +0100 |
User-agent: |
Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.2 (gnu/linux) |
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> 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.
window-configuration-change-hook is not exactly what I was looking for,
but in the absence of a more straight-forward solution I'll give it a
try. If the only thing that happens is a 'switch-window or
'switch-buffer command - is that considered a
window-configuration-change and triggers the hook?
--
cheers,
Thorsten