emacs-devel
[Top][All Lists]
Advanced

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

Re: HowTo: Run a hook when a buffer becomes "current"


From: T.V Raman
Subject: Re: HowTo: Run a hook when a buffer becomes "current"
Date: Wed, 16 Dec 2015 15:20:35 -0800

For now, the only solution I've found is to advice select-window.

Interestingly, the documentation for select-window points you at
buffer-list-update-hook -- but it's likely that that hook's usage has
diverged since that documentation for select-window was written;  for
fun I tried this:

(defvar record nil)
(defun my-record-buffer () (push  (buffer-name)  record))
(add-hook 'buffer-list-update-hook #'my-record-buffer)

A single buffer switch causes a lot of things to get pushed there 

David Kastrup writes:
 > Nicolas Richard <address@hidden> writes:
 > 
 > > raman <address@hidden> writes:
 > >
 > >> I was looking for a way of running a function when a buffer becomes
 > >> "current". I cant find any hooks in Emacs -- the closest is
 > >> buffer-list-update-hook -- but that gets called way too often
 > >> including when a buffer is buried, is visited transiently from within
 > >> lisp code etc.
 > >
 > > I think you're after window-configuration-change-hook, see
 > > (info "(elisp) Window Hooks")
 > 
 > That would be for "selected", not "current".
 > 
 > -- 
 > David Kastrup

-- 

-- 



reply via email to

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