[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Finding last *Async Shell Command* buffer?
From: |
Jean Louis |
Subject: |
Re: Finding last *Async Shell Command* buffer? |
Date: |
Fri, 26 Mar 2021 23:06:56 +0300 |
User-agent: |
Mutt/2.0.6 (2021-03-06) |
* Filipp Gunbin <fgunbin@fastmail.fm> [2021-03-26 16:10]:
> 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)))
I have tried it, but error:
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
get-buffer(nil)
display-buffer(nil)
(let ((b (nth pos (seq-filter #'(lambda (buf) (string-match ... ...))
(buffer-list))))) (display-buffer b))
my-find-latest-async-buf(1)
funcall-interactively(my-find-latest-async-buf 1)
call-interactively(my-find-latest-async-buf record nil)
command-execute(my-find-latest-async-buf record)
execute-extended-command(nil "my-find-latest-async-buf" nil)
funcall-interactively(execute-extended-command nil "my-find-latest-async-buf"
nil)
call-interactively(execute-extended-command nil nil)
command-execute(execute-extended-command)
- Re: [solved]: Re: Finding last *Async Shell Command* buffer?, (continued)
Re: Finding last *Async Shell Command* buffer?, Jean Louis, 2021/03/25
Re: Finding last *Async Shell Command* buffer?, Filipp Gunbin, 2021/03/25
Re: Finding last *Async Shell Command* buffer?, Jean Louis, 2021/03/25