unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* switch-buffer-hook to catch the switch-event?
@ 2013-02-26  0:41 Thorsten Jolitz
  2013-02-26  3:14 ` Stefan Monnier
       [not found] ` <mailman.20875.1361848468.855.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 6+ messages in thread
From: Thorsten Jolitz @ 2013-02-26  0:41 UTC (permalink / raw)
  To: help-gnu-emacs


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





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-02-26 23:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-26  0:41 switch-buffer-hook to catch the switch-event? Thorsten Jolitz
2013-02-26  3:14 ` Stefan Monnier
2013-02-26  4:23   ` Thorsten Jolitz
2013-02-26  5:11     ` Stefan Monnier
     [not found] ` <mailman.20875.1361848468.855.help-gnu-emacs@gnu.org>
2013-02-26 19:46   ` Sean McAfee
2013-02-26 23:38     ` Thorsten Jolitz

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).