help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Finding last *Async Shell Command* buffer?


From: Eli Zaretskii
Subject: Re: Finding last *Async Shell Command* buffer?
Date: Fri, 26 Mar 2021 14:31:17 +0300

> Date: Fri, 26 Mar 2021 10:54:07 +0300
> From: Jean Louis <bugs@gnu.support>
> Cc: help-gnu-emacs@gnu.org
> 
> > > I have tried using that function, but again, how do I get the last
> > > buffer?
> > 
> > By comparing the current buffer-list with the previous one?
> 
> My naive attempt does not show any difference, as I am doing something
> wrong.
> 
> (setq last-buffer-list nil)
> 
> (defun rcd-last-async-buffer (&rest args)
>   (let ((last (set-difference last-buffer-list (buffer-list))))
>     (message "Last buffer: %s" last))
>   (setq last-buffer-list (buffer-list)))
> 
> (add-hook 'buffer-list-update-hook 'rcd-last-async-buffer)

That hook is called for events other than buffer creation.  Are you
sure you looked at those where a buffer was created?



reply via email to

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