[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
switch-buffer-hook to catch the switch-event?
From: |
Thorsten Jolitz |
Subject: |
switch-buffer-hook to catch the switch-event? |
Date: |
Tue, 26 Feb 2013 01:41:01 +0100 |
User-agent: |
Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.2 (gnu/linux) |
Hi List,
I want to revert a buffer everytime it is switched to (it becomes
current-buffer). Searching the web and the manuals for a related emacs
hook, I found out that someone asked the same question before - but with
no 'positive' answer.
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?
from: http://emacswiki.org/emacs/SwitchingBuffers
,-------------------------------------------------------------------------
| Question: Is there a way to find out that the user has switched to a
| buffer, i.e., someting like switch-to-buffer-hook? The manual seems to
| say no, which is surprising. I would like to set some frame-specific
| variables according to the buffer which has been selected….
| JoergVolbers?
|
| If you don’t need to know when the switch was made, and you just
| need to know the current buffer, use function ‘current-buffer’. You
| might also want to look at variable ‘major-mode’ and the hooks
| ‘change-major-mode-hook’ and ‘after-change-major-mode-hook’. The
| last of these is in Emacs 22 only. – DrewAdams
|
| Thank you for the fast reply, but what I want to do is to catch, so to
| speak, the switch-event [...]
`-------------------------------------------------------------------------
--
cheers,
Thorsten
- switch-buffer-hook to catch the switch-event?,
Thorsten Jolitz <=