From 6f443e47ac2ac9f8b44834efc6af4c9eb6ac226f Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Sun, 9 Nov 2014 01:52:59 +0200 Subject: [PATCH] * lisp/simple.el (shell-command): Use buffer-name when output-buffer is a buffer. Fixes: debbugs:18096 --- lisp/ChangeLog | 5 +++++ lisp/simple.el | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e2bf6bdeeae..0aa7f04fecc 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-11-08 Juri Linkov + + * simple.el (shell-command): Use buffer-name when output-buffer is + a buffer. (Bug#18096) + 2014-11-08 Juri Linkov * minibuffer.el (minibuffer-completion-help): Compare this-command diff --git a/lisp/simple.el b/lisp/simple.el index 08374c4ed65..203ea514e15 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -3077,12 +3077,14 @@ the use of a shell (with its need to quote arguments)." ;; If will create a new buffer, query first. (if (yes-or-no-p "A command is running in the default buffer. Use a new buffer? ") (setq buffer (generate-new-buffer - (or output-buffer "*Async Shell Command*"))) + (or (and (bufferp output-buffer) (buffer-name output-buffer)) + output-buffer "*Async Shell Command*"))) (error "Shell command in progress"))) ((eq async-shell-command-buffer 'new-buffer) ;; It will create a new buffer. (setq buffer (generate-new-buffer - (or output-buffer "*Async Shell Command*")))) + (or (and (bufferp output-buffer) (buffer-name output-buffer)) + output-buffer "*Async Shell Command*")))) ((eq async-shell-command-buffer 'confirm-rename-buffer) ;; If will rename the buffer, query first. (if (yes-or-no-p "A command is running in the default buffer. Rename it? ") -- 2.39.5