diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index 47f195d0b2..ca3d52c36a 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -846,6 +846,9 @@ Single Shell shell-command output. @end table +In case the output buffer is not the current buffer, shell command +output is appended at the end of this buffer. + @node Interactive Shell @subsection Interactive Subshell diff --git a/lisp/simple.el b/lisp/simple.el index ab277c4e11..2f0626d96e 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -3606,6 +3606,9 @@ shell-command interactively when the prefix argument is given), insert the output in current buffer after point leaving mark after it. This cannot be done asynchronously. +If OUTPUT-BUFFER is a buffer or buffer name different from the +current buffer, append the output in this buffer instead of +inserting it at point. The user option `shell-command-dont-erase-buffer', which see, controls whether the output buffer is erased and where to put point after