From 87c23670111b03768dc722208dfe11183cebc5d5 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Fri, 28 Jan 2022 16:32:15 +0100 Subject: [PATCH] Clarify where the shell-command output goes * lisp/simple.el (shell-command): * doc/emacs/misc.texi (Single Shell): Clarify where the output goes if the specified buffer isn't the current one (bug#40896). --- doc/emacs/misc.texi | 3 +++ lisp/simple.el | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index 365c079e897..4710c05b620 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -856,6 +856,9 @@ Restores the position of point as it was before inserting the 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 801a3c992c8..00669ac6349 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -4092,6 +4092,10 @@ 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, instead of outputting at point in that buffer, +the output will be appended at the end of that buffer. + The user option `shell-command-dont-erase-buffer', which see, controls whether the output buffer is erased and where to put point after the shell command. -- 2.39.5