unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Jean Louis <bugs@gnu.support>
To: Help GNU Emacs <help-gnu-emacs@gnu.org>
Subject: Re: Finding last *Async Shell Command* buffer?
Date: Fri, 26 Mar 2021 23:06:56 +0300	[thread overview]
Message-ID: <YF4+4OF/p1TAcdfZ@protected.localdomain> (raw)
In-Reply-To: <m28s6a6ozs.fsf@fastmail.fm>

* 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)



  parent reply	other threads:[~2021-03-26 20:06 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-25 14:33 Finding last *Async Shell Command* buffer? Jean Louis
2021-03-25 15:03 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-03-25 15:08   ` Jean Louis
2021-03-25 20:27     ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-03-25 20:36       ` Jean Louis
2021-03-25 20:50         ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-03-25 20:59           ` Jean Louis
2021-03-25 21:08             ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-03-25 21:12               ` Jean Louis
2021-03-26  5:52                 ` Robert Thorpe
2021-03-26  6:47                   ` Eli Zaretskii
2021-03-26  7:04                     ` Jean Louis
2021-03-26  7:18                       ` Eli Zaretskii
2021-03-26  7:28                       ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-03-26  7:38                         ` Jean Louis
2021-03-26  7:52                           ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-03-26  8:43                             ` Jean Louis
2021-03-26 13:37                               ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-03-26 20:08                                 ` Jean Louis
2021-03-26 21:59                                   ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-03-26  7:17                     ` Jean Louis
2021-03-26  7:47                       ` Eli Zaretskii
2021-03-26  7:54                         ` Jean Louis
2021-03-26 11:31                           ` Eli Zaretskii
2021-03-26 14:02                           ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-03-26 20:11                             ` Jean Louis
2021-03-26 22:00                               ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-03-26 23:28                                 ` Jean Louis
2021-03-26 23:39                                   ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-03-26  7:01                   ` Jean Louis
2021-03-26  7:09                     ` Eli Zaretskii
2021-03-26  7:25                       ` [solved]: " Jean Louis
2021-03-26  7:31                         ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-03-26  7:40                           ` Jean Louis
2021-03-26  7:56                         ` Eli Zaretskii
2021-03-26  8:55                           ` Jean Louis
2021-03-26 11:18                             ` Eli Zaretskii
2021-03-26 11:26                               ` Jean Louis
2021-03-26 11:33                                 ` Eli Zaretskii
2021-03-26 11:48                                   ` Jean Louis
2021-03-26 12:37                                     ` Eli Zaretskii
2021-03-26 20:05                                       ` Jean Louis
2021-03-26 22:02                                         ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-03-26 23:29                                           ` Jean Louis
2021-03-26 23:41                                             ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-03-26 13:49                                     ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-03-26 10:34                           ` Jean Louis
2021-03-26 11:30                             ` Eli Zaretskii
2021-03-25 15:18   ` Jean Louis
2021-03-25 15:54     ` Skip Montanaro
2021-03-25 19:31       ` Jean Louis
2021-03-25 18:10 ` Filipp Gunbin
2021-03-25 19:40   ` Jean Louis
2021-03-26 13:09     ` Filipp Gunbin
2021-03-26 13:40       ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-03-26 20:06       ` Jean Louis [this message]
2021-03-26 21:17         ` Filipp Gunbin
2021-03-25 20:05   ` Jean Louis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YF4+4OF/p1TAcdfZ@protected.localdomain \
    --to=bugs@gnu.support \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).