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: Sat, 27 Mar 2021 00:17:18 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (darwin)

On 26/03/2021 23:06 +0300, Jean Louis wrote:

> I have tried it, but error:
>
> Debugger entered--Lisp error: (wrong-type-argument stringp nil)
>   get-buffer(nil)
>   display-buffer(nil)
...

Forgot to add non-nil check:

(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)))))
    (if b
        (display-buffer b)
      (message "No %dth async-shell buffer to display" pos))))

Filipp



reply via email to

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