4

When I give a new async command with an interactively called async-shell-command, it gives a message "A command is running in the default buffer. Use a new buffer? (y or n)". I think this behaviour is unnecessary, every time I'm giving a new command, I'll press y. Can I disable this behavior in some way?

1 Answer 1

6

You may be interested in creating a new/modified function of shell-command that does not seek confirmation. You may also be interested in customizing the variable async-shell-command-buffer. For a listing of the options, type M-x describe-variable or C-h v.

To see how this variable works within the function shell-command, type M-x find-function RET shell-command RET.

How did I find this out? I typed M-x find-function RET async-shell-command-buffer RET and I did a word search in that library for "a command is running". There are other methods to find this stuff out, like reading the manual that probably discusses the above-variable ... however, I usually just examine the code to figure stuff out.

4
  • I didn't know about find-function! answers like yours really help me do my research before coming here, so thank you for that. Apr 22, 2018 at 17:39
  • I had this issue, too, and customizing async-shell-command-buffer did exactly what I needed. Thanks.
    – Chris
    May 10, 2018 at 14:47
  • You may want to mention that this user option is documented under (emacs) Single Shell.
    – Basil
    May 10, 2018 at 14:54
  • Thans for adding the How bit. I suppose you did M-x find-function RET shell-command RET rather than async-shell-command-buffer.
    – AstroFloyd
    Oct 6, 2019 at 8:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.