[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
--
--
- HowTo: Run a hook when a buffer becomes "current", raman, 2015/12/16
- Re: HowTo: Run a hook when a buffer becomes "current", Nicolas Richard, 2015/12/16
- Re: HowTo: Run a hook when a buffer becomes "current", Richard Stallman, 2015/12/16
- Re: HowTo: Run a hook when a buffer becomes "current", raman, 2015/12/17
- Re: HowTo: Run a hook when a buffer becomes "current", Richard Stallman, 2015/12/18
- Re: HowTo: Run a hook when a buffer becomes "current", raman, 2015/12/19
- Re: HowTo: Run a hook when a buffer becomes "current", Dmitry Gutov, 2015/12/19
- Re: HowTo: Run a hook when a buffer becomes "current", raman, 2015/12/19