From: Jean Louis <bugs@gnu.support>
To: Skip Montanaro <skip.montanaro@gmail.com>
Cc: Help GNU Emacs <help-gnu-emacs@gnu.org>
Subject: Re: Finding last *Async Shell Command* buffer?
Date: Thu, 25 Mar 2021 22:31:04 +0300 [thread overview]
Message-ID: <YFzk+PKjzM9rLll8@protected.localdomain> (raw)
In-Reply-To: <CANc-5UyZzEbxyNcYLKyT2z9mf4cyaux+HNd_fYPzZv1DYu48rA@mail.gmail.com>
* Skip Montanaro <skip.montanaro@gmail.com> [2021-03-25 18:53]:
> > > The *Buffer List* should be sorted but if you want even
> > > faster, tell me what these buffers are called exactly...
> >
> > To find out the buffer by listing, I would need to enter each buffer
> > and review it if it is the right one.
>
> You forgot to answer the last bit. How are these *Async Shell Command*
> buffers named? If there is just one, that is, by definition, the last
> one, I believe. If some counter is incremented each time one is
> created to avoid name collisions, choose the one with the largest
> number.
I have not inspected enough the function to understand how they are
created. But I know function `generate-new-buffer' and it seem like it
is created that way. It adds <NR> to the name of the buffer:
(generate-new-buffer "My new buffer") → My new buffer
(generate-new-buffer "My new buffer") → My new buffer<2>
(generate-new-buffer "My new buffer") → My new buffer<3>
(generate-new-buffer "My new buffer") → My new buffer<4>
Now if I delete buffer 2 by mistake or intentionally:
(kill-buffer "My new buffer<2>")
what happens in the next invokation is:
(generate-new-buffer "My new buffer") → My new buffer<2>
So that way among hundreds of buffer is difficult to find the buffer
that belongs to last invoked command.
> Can you give an example of how to create one or more of these
> buffers?
I invoke often commands by using M-S-& or in dired with & and it is
difficult to quickly find the output of last command. Sometimes is
output important.
> I'm not sure I've ever used an async shell before.
I am launching new programs and some Emacs commands also invoke async
shell. Sometimes I am using rsync as async-shell, so copy process goes
without blocking the interface.
Programmatically it should be easier to invoke it or I could even
change the function. But I was thinking there is maybe some way to
find the last async buffer.
From description form M-&: `async-shell-command':
The output appears in the buffer whose name is stored in the
variable ‘shell-command-buffer-name-async’. That buffer is in
shell mode.
Programmatically I could then make a function that changes the above
value by getting instead of the available number on the end, the date
or time part on the end, as that way it would be easy to parse list of
buffers created and find the last one. I I then replace M-& with that
new function that provides different buffer name by date/time, then it
is solved. That seem like direction forward.
next prev parent reply other threads:[~2021-03-25 19:31 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 [this message]
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
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YFzk+PKjzM9rLll8@protected.localdomain \
--to=bugs@gnu.support \
--cc=help-gnu-emacs@gnu.org \
--cc=skip.montanaro@gmail.com \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.