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: Filipp Gunbin
Subject: Re: Finding last *Async Shell Command* buffer?
Date: Fri, 26 Mar 2021 16:09:11 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (darwin)

On 25/03/2021 22:40 +0300, Jean Louis wrote:

> * Filipp Gunbin <fgunbin@fastmail.fm> [2021-03-25 21:10]:
>> On 25/03/2021 17:33 +0300, Jean Louis wrote:
>>
>> > Is there way to find the last *Async Shell Command* buffer?
>> >
>> > Often I like running commands in background but there is hundreds of
>> > buffers and it would be useful to have a command to quickly change to
>> > the last one invoked.
>> >
>> > Jean
>>
>> isearch over minibuffer "future history" will give the same order as
>> *Buffer List* (latest first), so
>>
>> C-x b C-s async (possibly followed by more C-s)
>
> Yes, I could peek in the list. What I mean is to press a key and get
> latest buffer, maybe there is some internal date/time when buffers
> were created.

Something like this?

(defun my-find-latest-async-buf (pos)
  (interactive "p")
  (or pos (setq pos 0))
  (let ((b (nth pos (seq-filter (lambda (buf)
                                  (string-match (regexp-quote 
shell-command-buffer-name-async)
                                                (buffer-name buf)))
                                (buffer-list)))))
    (display-buffer b)))



reply via email to

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