diff options
| author | Tino Calancha | 2020-08-09 14:18:09 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2020-08-09 14:18:09 +0200 |
| commit | 2ed502d2a76e93ecd5366a6ec3926894e4fbe827 (patch) | |
| tree | 7cbce9bf365767e57f2477ee132e669e0143b16f | |
| parent | db77e9a0da934ba40950bc1306df61b6785843e0 (diff) | |
| download | emacs-2ed502d2a76e93ecd5366a6ec3926894e4fbe827.tar.gz emacs-2ed502d2a76e93ecd5366a6ec3926894e4fbe827.zip | |
Add constants for shell command output buffer names
Buffers `*Shell Command Output*' and `*Async Shell Command*'
have been around since a long time; used across several libraries,
they are de facto output buffers for shell commands.
* lisp/simple.el (shell-command-buffer-name)
(shell-command-buffer-name-async): New variables.
* lisp/dired-aux.el
* lisp/gnus/gnus-sum.el
* lisp/gnus/gnus-win.el
* lisp/ibuf-ext.el
* lisp/net/tramp.el: Use them.
* etc/NEWS (Changes in Emacs 28.1): Announce this change.
* doc/emacs/misc.texi (Single Shell)
* doc/misc/tramp.texi (Remote processes):
Update manual (bug#39138).
| -rw-r--r-- | doc/emacs/misc.texi | 19 | ||||
| -rw-r--r-- | doc/misc/tramp.texi | 2 | ||||
| -rw-r--r-- | etc/NEWS | 5 | ||||
| -rw-r--r-- | lisp/dired-aux.el | 6 | ||||
| -rw-r--r-- | lisp/gnus/gnus-sum.el | 2 | ||||
| -rw-r--r-- | lisp/gnus/gnus-win.el | 2 | ||||
| -rw-r--r-- | lisp/ibuf-ext.el | 6 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 4 | ||||
| -rw-r--r-- | lisp/simple.el | 37 |
9 files changed, 50 insertions, 33 deletions
diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index e7547ebff7c..cb9fc61f327 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi | |||
| @@ -724,13 +724,15 @@ See the Eshell Info manual, which is distributed with Emacs. | |||
| 724 | 724 | ||
| 725 | @kindex M-! | 725 | @kindex M-! |
| 726 | @findex shell-command | 726 | @findex shell-command |
| 727 | @vindex shell-command-buffer-name | ||
| 727 | @kbd{M-!} (@code{shell-command}) reads a line of text using the | 728 | @kbd{M-!} (@code{shell-command}) reads a line of text using the |
| 728 | minibuffer and executes it as a shell command, in a subshell made just | 729 | minibuffer and executes it as a shell command, in a subshell made just |
| 729 | for that command. Standard input for the command comes from the null | 730 | for that command. Standard input for the command comes from the null |
| 730 | device. If the shell command produces any output, the output appears | 731 | device. If the shell command produces any output, the output appears |
| 731 | either in the echo area (if it is short), or in an Emacs buffer named | 732 | either in the echo area (if it is short), or in an Emacs buffer, |
| 732 | @file{*Shell Command Output*}, displayed in another window (if the | 733 | displayed in another window (if the output is long). The name of |
| 733 | output is long). The variables @code{resize-mini-windows} and | 734 | this buffer is taken from the constant @code{shell-command-buffer-name}. |
| 735 | The variables @code{resize-mini-windows} and | ||
| 734 | @code{max-mini-window-height} (@pxref{Minibuffer Edit}) control when | 736 | @code{max-mini-window-height} (@pxref{Minibuffer Edit}) control when |
| 735 | Emacs should consider the output to be too long for the echo area. | 737 | Emacs should consider the output to be too long for the echo area. |
| 736 | 738 | ||
| @@ -758,15 +760,16 @@ which is impossible to ignore. | |||
| 758 | 760 | ||
| 759 | @kindex M-& | 761 | @kindex M-& |
| 760 | @findex async-shell-command | 762 | @findex async-shell-command |
| 763 | @vindex shell-command-buffer-name-async | ||
| 761 | A shell command that ends in @samp{&} is executed | 764 | A shell command that ends in @samp{&} is executed |
| 762 | @dfn{asynchronously}, and you can continue to use Emacs as it runs. | 765 | @dfn{asynchronously}, and you can continue to use Emacs as it runs. |
| 763 | You can also type @kbd{M-&} (@code{async-shell-command}) to execute a | 766 | You can also type @kbd{M-&} (@code{async-shell-command}) to execute a |
| 764 | shell command asynchronously; this is exactly like calling @kbd{M-!} | 767 | shell command asynchronously; this is exactly like calling @kbd{M-!} |
| 765 | with a trailing @samp{&}, except that you do not need the @samp{&}. | 768 | with a trailing @samp{&}, except that you do not need the @samp{&}. |
| 766 | The default output buffer for asynchronous shell commands is named | 769 | The constant @code{shell-command-buffer-name-async} stores the name |
| 767 | @samp{*Async Shell Command*}. Emacs inserts the output into this | 770 | of the default output buffer for asynchronous shell commands. |
| 768 | buffer as it comes in, whether or not the buffer is visible in a | 771 | Emacs inserts the output into this buffer as it comes in, |
| 769 | window. | 772 | whether or not the buffer is visible in a window. |
| 770 | 773 | ||
| 771 | @vindex async-shell-command-buffer | 774 | @vindex async-shell-command-buffer |
| 772 | If you want to run more than one asynchronous shell command at the | 775 | If you want to run more than one asynchronous shell command at the |
| @@ -804,7 +807,7 @@ old region and replaces it with the output from the shell command. | |||
| 804 | see what keys are in the buffer. If the buffer contains a GnuPG key, | 807 | see what keys are in the buffer. If the buffer contains a GnuPG key, |
| 805 | type @kbd{C-x h M-| gpg @key{RET}} to feed the entire buffer contents | 808 | type @kbd{C-x h M-| gpg @key{RET}} to feed the entire buffer contents |
| 806 | to @command{gpg}. This will output the list of keys to the | 809 | to @command{gpg}. This will output the list of keys to the |
| 807 | @file{*Shell Command Output*} buffer. | 810 | buffer named @code{shell-command-buffer-name}. |
| 808 | 811 | ||
| 809 | @vindex shell-file-name | 812 | @vindex shell-file-name |
| 810 | The above commands use the shell specified by the variable | 813 | The above commands use the shell specified by the variable |
diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index 56cd220e20e..ae6fe3d9ea0 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi | |||
| @@ -3379,7 +3379,7 @@ host. Example: | |||
| 3379 | @end example | 3379 | @end example |
| 3380 | 3380 | ||
| 3381 | @command{tail} command outputs continuously to the local buffer, | 3381 | @command{tail} command outputs continuously to the local buffer, |
| 3382 | @file{*Async Shell Command*} | 3382 | named @code{shell-command-buffer-name-async} |
| 3383 | 3383 | ||
| 3384 | @kbd{M-x auto-revert-tail-mode @key{RET}} runs similarly showing | 3384 | @kbd{M-x auto-revert-tail-mode @key{RET}} runs similarly showing |
| 3385 | continuous output. | 3385 | continuous output. |
| @@ -80,6 +80,11 @@ useful on systems such as FreeBSD which ships only with "etc/termcap". | |||
| 80 | 80 | ||
| 81 | * Changes in Emacs 28.1 | 81 | * Changes in Emacs 28.1 |
| 82 | 82 | ||
| 83 | +++ | ||
| 84 | ** The new constants 'shell-command-buffer-name' and | ||
| 85 | 'shell-command-buffer-name-async' store the default buffer names | ||
| 86 | for the output of shell commands. | ||
| 87 | |||
| 83 | ** Support for '(box . SIZE)' 'cursor-type'. | 88 | ** Support for '(box . SIZE)' 'cursor-type'. |
| 84 | By default, 'box' cursor always has a filled box shape. But if you | 89 | By default, 'box' cursor always has a filled box shape. But if you |
| 85 | specify 'cursor-type' to be '(box . SIZE)', the cursor becomes a hollow | 90 | specify 'cursor-type' to be '(box . SIZE)', the cursor becomes a hollow |
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 6587d039b72..84d8c36f45f 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el | |||
| @@ -688,7 +688,7 @@ are executed in the background on each file sequentially waiting | |||
| 688 | for each command to terminate before running the next command. | 688 | for each command to terminate before running the next command. |
| 689 | In shell syntax this means separating the individual commands with `;'. | 689 | In shell syntax this means separating the individual commands with `;'. |
| 690 | 690 | ||
| 691 | The output appears in the buffer `*Async Shell Command*'." | 691 | The output appears in the buffer `shell-command-buffer-name-async'." |
| 692 | (interactive | 692 | (interactive |
| 693 | (let ((files (dired-get-marked-files t current-prefix-arg nil nil t))) | 693 | (let ((files (dired-get-marked-files t current-prefix-arg nil nil t))) |
| 694 | (list | 694 | (list |
| @@ -727,7 +727,7 @@ it, write `*\"\"' in place of just `*'. This is equivalent to just | |||
| 727 | 727 | ||
| 728 | If COMMAND ends in `&', `;', or `;&', it is executed in the | 728 | If COMMAND ends in `&', `;', or `;&', it is executed in the |
| 729 | background asynchronously, and the output appears in the buffer | 729 | background asynchronously, and the output appears in the buffer |
| 730 | `*Async Shell Command*'. When operating on multiple files and COMMAND | 730 | `shell-command-buffer-name-async'. When operating on multiple files and COMMAND |
| 731 | ends in `&', the shell command is executed on each file in parallel. | 731 | ends in `&', the shell command is executed on each file in parallel. |
| 732 | However, when COMMAND ends in `;' or `;&' then commands are executed | 732 | However, when COMMAND ends in `;' or `;&' then commands are executed |
| 733 | in the background on each file sequentially waiting for each command | 733 | in the background on each file sequentially waiting for each command |
| @@ -735,7 +735,7 @@ to terminate before running the next command. You can also use | |||
| 735 | `dired-do-async-shell-command' that automatically adds `&'. | 735 | `dired-do-async-shell-command' that automatically adds `&'. |
| 736 | 736 | ||
| 737 | Otherwise, COMMAND is executed synchronously, and the output | 737 | Otherwise, COMMAND is executed synchronously, and the output |
| 738 | appears in the buffer `*Shell Command Output*'. | 738 | appears in the buffer `shell-command-buffer-name'. |
| 739 | 739 | ||
| 740 | This feature does not try to redisplay Dired buffers afterward, as | 740 | This feature does not try to redisplay Dired buffers afterward, as |
| 741 | there's no telling what files COMMAND may have changed. | 741 | there's no telling what files COMMAND may have changed. |
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index 719498a0337..4363860eac8 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el | |||
| @@ -12284,7 +12284,7 @@ no matter what the properties `:decode' and `:headers' are." | |||
| 12284 | (interactive (gnus-interactive "P\ny")) | 12284 | (interactive (gnus-interactive "P\ny")) |
| 12285 | (require 'gnus-art) | 12285 | (require 'gnus-art) |
| 12286 | (let* ((articles (gnus-summary-work-articles n)) | 12286 | (let* ((articles (gnus-summary-work-articles n)) |
| 12287 | (result-buffer "*Shell Command Output*") | 12287 | (result-buffer shell-command-buffer-name) |
| 12288 | (all-headers (not (memq sym '(nil r)))) | 12288 | (all-headers (not (memq sym '(nil r)))) |
| 12289 | (gnus-save-all-headers (or all-headers gnus-save-all-headers)) | 12289 | (gnus-save-all-headers (or all-headers gnus-save-all-headers)) |
| 12290 | (raw (eq sym 'r)) | 12290 | (raw (eq sym 'r)) |
diff --git a/lisp/gnus/gnus-win.el b/lisp/gnus/gnus-win.el index 36b28350362..baa3146e64e 100644 --- a/lisp/gnus/gnus-win.el +++ b/lisp/gnus/gnus-win.el | |||
| @@ -142,7 +142,7 @@ used to display Gnus windows." | |||
| 142 | (pipe | 142 | (pipe |
| 143 | (vertical 1.0 | 143 | (vertical 1.0 |
| 144 | (summary 0.25 point) | 144 | (summary 0.25 point) |
| 145 | ("*Shell Command Output*" 1.0))) | 145 | (shell-command-buffer-name 1.0))) |
| 146 | (bug | 146 | (bug |
| 147 | (vertical 1.0 | 147 | (vertical 1.0 |
| 148 | (if gnus-bug-create-help-buffer '("*Gnus Help Bug*" 0.5)) | 148 | (if gnus-bug-create-help-buffer '("*Gnus Help Bug*" 0.5)) |
diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el index bfb9787a96d..c9ca1f87424 100644 --- a/lisp/ibuf-ext.el +++ b/lisp/ibuf-ext.el | |||
| @@ -504,7 +504,7 @@ format. See `ibuffer-update-saved-filters-format' and | |||
| 504 | (ibuffer-forward-line 0)) | 504 | (ibuffer-forward-line 0)) |
| 505 | 505 | ||
| 506 | (defun ibuffer--maybe-erase-shell-cmd-output () | 506 | (defun ibuffer--maybe-erase-shell-cmd-output () |
| 507 | (let ((buf (get-buffer "*Shell Command Output*"))) | 507 | (let ((buf (get-buffer shell-command-buffer-name))) |
| 508 | (when (and (buffer-live-p buf) | 508 | (when (and (buffer-live-p buf) |
| 509 | (not shell-command-dont-erase-buffer) | 509 | (not shell-command-dont-erase-buffer) |
| 510 | (not (zerop (buffer-size buf)))) | 510 | (not (zerop (buffer-size buf)))) |
| @@ -517,7 +517,7 @@ format. See `ibuffer-update-saved-filters-format' and | |||
| 517 | :opstring "Shell command executed on" | 517 | :opstring "Shell command executed on" |
| 518 | :before (ibuffer--maybe-erase-shell-cmd-output) | 518 | :before (ibuffer--maybe-erase-shell-cmd-output) |
| 519 | :modifier-p nil) | 519 | :modifier-p nil) |
| 520 | (let ((out-buf (get-buffer-create "*Shell Command Output*"))) | 520 | (let ((out-buf (get-buffer-create shell-command-buffer-name))) |
| 521 | (with-current-buffer out-buf (goto-char (point-max))) | 521 | (with-current-buffer out-buf (goto-char (point-max))) |
| 522 | (call-shell-region (point-min) (point-max) | 522 | (call-shell-region (point-min) (point-max) |
| 523 | command nil out-buf))) | 523 | command nil out-buf))) |
| @@ -542,7 +542,7 @@ format. See `ibuffer-update-saved-filters-format' and | |||
| 542 | :modifier-p nil) | 542 | :modifier-p nil) |
| 543 | (let ((file (and (not (buffer-modified-p)) | 543 | (let ((file (and (not (buffer-modified-p)) |
| 544 | buffer-file-name)) | 544 | buffer-file-name)) |
| 545 | (out-buf (get-buffer-create "*Shell Command Output*"))) | 545 | (out-buf (get-buffer-create shell-command-buffer-name))) |
| 546 | (unless (and file (file-exists-p file)) | 546 | (unless (and file (file-exists-p file)) |
| 547 | (setq file | 547 | (setq file |
| 548 | (make-temp-file | 548 | (make-temp-file |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index d1b2935a3c6..fdf26f6b782 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -3815,8 +3815,8 @@ support symbolic links." | |||
| 3815 | (current-buffer)) | 3815 | (current-buffer)) |
| 3816 | (t (get-buffer-create | 3816 | (t (get-buffer-create |
| 3817 | (if asynchronous | 3817 | (if asynchronous |
| 3818 | "*Async Shell Command*" | 3818 | shell-command-buffer-name-async |
| 3819 | "*Shell Command Output*"))))) | 3819 | shell-command-buffer-name))))) |
| 3820 | (error-buffer | 3820 | (error-buffer |
| 3821 | (cond | 3821 | (cond |
| 3822 | ((bufferp error-buffer) error-buffer) | 3822 | ((bufferp error-buffer) error-buffer) |
diff --git a/lisp/simple.el b/lisp/simple.el index 2f92238e640..6c9584aaa39 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -3369,6 +3369,14 @@ which is defined in the `warnings' library.\n") | |||
| 3369 | (setq buffer-undo-list nil) | 3369 | (setq buffer-undo-list nil) |
| 3370 | t)) | 3370 | t)) |
| 3371 | 3371 | ||
| 3372 | ;;;; Shell commands | ||
| 3373 | |||
| 3374 | (defconst shell-command-buffer-name "*Shell Command Output*" | ||
| 3375 | "Name of the output buffer for shell commands.") | ||
| 3376 | |||
| 3377 | (defconst shell-command-buffer-name-async "*Async Shell Command*" | ||
| 3378 | "Name of the output buffer for asynchronous shell commands.") | ||
| 3379 | |||
| 3372 | (defvar shell-command-history nil | 3380 | (defvar shell-command-history nil |
| 3373 | "History list for some commands that read shell commands. | 3381 | "History list for some commands that read shell commands. |
| 3374 | 3382 | ||
| @@ -3433,7 +3441,7 @@ to `shell-command-history'." | |||
| 3433 | (defcustom async-shell-command-buffer 'confirm-new-buffer | 3441 | (defcustom async-shell-command-buffer 'confirm-new-buffer |
| 3434 | "What to do when the output buffer is used by another shell command. | 3442 | "What to do when the output buffer is used by another shell command. |
| 3435 | This option specifies how to resolve the conflict where a new command | 3443 | This option specifies how to resolve the conflict where a new command |
| 3436 | wants to direct its output to the buffer `*Async Shell Command*', | 3444 | wants to direct its output to the buffer `shell-command-buffer-name-async', |
| 3437 | but this buffer is already taken by another running shell command. | 3445 | but this buffer is already taken by another running shell command. |
| 3438 | 3446 | ||
| 3439 | The value `confirm-kill-process' is used to ask for confirmation before | 3447 | The value `confirm-kill-process' is used to ask for confirmation before |
| @@ -3585,14 +3593,14 @@ whose `car' is BUFFER." | |||
| 3585 | Like `shell-command', but adds `&' at the end of COMMAND | 3593 | Like `shell-command', but adds `&' at the end of COMMAND |
| 3586 | to execute it asynchronously. | 3594 | to execute it asynchronously. |
| 3587 | 3595 | ||
| 3588 | The output appears in the buffer `*Async Shell Command*'. | 3596 | The output appears in the buffer `shell-command-buffer-name-async'. |
| 3589 | That buffer is in shell mode. | 3597 | That buffer is in shell mode. |
| 3590 | 3598 | ||
| 3591 | You can configure `async-shell-command-buffer' to specify what to do | 3599 | You can configure `async-shell-command-buffer' to specify what to do |
| 3592 | when the `*Async Shell Command*' buffer is already taken by another | 3600 | when the `shell-command-buffer-name-async' buffer is already taken by another |
| 3593 | running shell command. To run COMMAND without displaying the output | 3601 | running shell command. To run COMMAND without displaying the output |
| 3594 | in a window you can configure `display-buffer-alist' to use the action | 3602 | in a window you can configure `display-buffer-alist' to use the action |
| 3595 | `display-buffer-no-window' for the buffer `*Async Shell Command*'. | 3603 | `display-buffer-no-window' for the buffer `shell-command-buffer-name-async'. |
| 3596 | 3604 | ||
| 3597 | In Elisp, you will often be better served by calling `start-process' | 3605 | In Elisp, you will often be better served by calling `start-process' |
| 3598 | directly, since it offers more control and does not impose the use of | 3606 | directly, since it offers more control and does not impose the use of |
| @@ -3628,12 +3636,12 @@ If `shell-command-prompt-show-cwd' is non-nil, show the current | |||
| 3628 | directory in the prompt. | 3636 | directory in the prompt. |
| 3629 | 3637 | ||
| 3630 | If COMMAND ends in `&', execute it asynchronously. | 3638 | If COMMAND ends in `&', execute it asynchronously. |
| 3631 | The output appears in the buffer `*Async Shell Command*'. | 3639 | The output appears in the buffer `shell-command-buffer-name-async'. |
| 3632 | That buffer is in shell mode. You can also use | 3640 | That buffer is in shell mode. You can also use |
| 3633 | `async-shell-command' that automatically adds `&'. | 3641 | `async-shell-command' that automatically adds `&'. |
| 3634 | 3642 | ||
| 3635 | Otherwise, COMMAND is executed synchronously. The output appears in | 3643 | Otherwise, COMMAND is executed synchronously. The output appears in |
| 3636 | the buffer `*Shell Command Output*'. If the output is short enough to | 3644 | the buffer `shell-command-buffer-name'. If the output is short enough to |
| 3637 | display in the echo area (which is determined by the variables | 3645 | display in the echo area (which is determined by the variables |
| 3638 | `resize-mini-windows' and `max-mini-window-height'), it is shown | 3646 | `resize-mini-windows' and `max-mini-window-height'), it is shown |
| 3639 | there, but it is nonetheless available in buffer `*Shell Command | 3647 | there, but it is nonetheless available in buffer `*Shell Command |
| @@ -3756,7 +3764,7 @@ impose the use of a shell (with its need to quote arguments)." | |||
| 3756 | (if (string-match "[ \t]*&[ \t]*\\'" command) | 3764 | (if (string-match "[ \t]*&[ \t]*\\'" command) |
| 3757 | ;; Command ending with ampersand means asynchronous. | 3765 | ;; Command ending with ampersand means asynchronous. |
| 3758 | (let* ((buffer (get-buffer-create | 3766 | (let* ((buffer (get-buffer-create |
| 3759 | (or output-buffer "*Async Shell Command*"))) | 3767 | (or output-buffer shell-command-buffer-name-async))) |
| 3760 | (bname (buffer-name buffer)) | 3768 | (bname (buffer-name buffer)) |
| 3761 | (proc (get-buffer-process buffer)) | 3769 | (proc (get-buffer-process buffer)) |
| 3762 | (directory default-directory)) | 3770 | (directory default-directory)) |
| @@ -3908,7 +3916,7 @@ and are used only if a pop-up buffer is displayed." | |||
| 3908 | error-buffer display-error-buffer | 3916 | error-buffer display-error-buffer |
| 3909 | region-noncontiguous-p) | 3917 | region-noncontiguous-p) |
| 3910 | "Execute string COMMAND in inferior shell with region as input. | 3918 | "Execute string COMMAND in inferior shell with region as input. |
| 3911 | Normally display output (if any) in temp buffer `*Shell Command Output*'; | 3919 | Normally display output (if any) in temp buffer `shell-command-buffer-name'; |
| 3912 | Prefix arg means replace the region with it. Return the exit code of | 3920 | Prefix arg means replace the region with it. Return the exit code of |
| 3913 | COMMAND. | 3921 | COMMAND. |
| 3914 | 3922 | ||
| @@ -3927,7 +3935,7 @@ in the echo area or in a buffer. | |||
| 3927 | If the output is short enough to display in the echo area | 3935 | If the output is short enough to display in the echo area |
| 3928 | \(determined by the variable `max-mini-window-height' if | 3936 | \(determined by the variable `max-mini-window-height' if |
| 3929 | `resize-mini-windows' is non-nil), it is shown there. | 3937 | `resize-mini-windows' is non-nil), it is shown there. |
| 3930 | Otherwise it is displayed in the buffer `*Shell Command Output*'. | 3938 | Otherwise it is displayed in the buffer `shell-command-buffer-name'. |
| 3931 | The output is available in that buffer in both cases. | 3939 | The output is available in that buffer in both cases. |
| 3932 | 3940 | ||
| 3933 | If there is output and an error, a message about the error | 3941 | If there is output and an error, a message about the error |
| @@ -3937,7 +3945,7 @@ Optional fourth arg OUTPUT-BUFFER specifies where to put the | |||
| 3937 | command's output. If the value is a buffer or buffer name, | 3945 | command's output. If the value is a buffer or buffer name, |
| 3938 | erase that buffer and insert the output there; a non-nil value of | 3946 | erase that buffer and insert the output there; a non-nil value of |
| 3939 | `shell-command-dont-erase-buffer' prevent to erase the buffer. | 3947 | `shell-command-dont-erase-buffer' prevent to erase the buffer. |
| 3940 | If the value is nil, use the buffer `*Shell Command Output*'. | 3948 | If the value is nil, use the buffer `shell-command-buffer-name'. |
| 3941 | Any other non-nil value means to insert the output in the | 3949 | Any other non-nil value means to insert the output in the |
| 3942 | current buffer after START. | 3950 | current buffer after START. |
| 3943 | 3951 | ||
| @@ -4006,7 +4014,7 @@ characters." | |||
| 4006 | (funcall region-insert-function output)) | 4014 | (funcall region-insert-function output)) |
| 4007 | (t | 4015 | (t |
| 4008 | (let ((buffer (get-buffer-create | 4016 | (let ((buffer (get-buffer-create |
| 4009 | (or output-buffer "*Shell Command Output*")))) | 4017 | (or output-buffer shell-command-buffer-name)))) |
| 4010 | (with-current-buffer buffer | 4018 | (with-current-buffer buffer |
| 4011 | (erase-buffer) | 4019 | (erase-buffer) |
| 4012 | (funcall region-insert-function output)) | 4020 | (funcall region-insert-function output)) |
| @@ -4025,7 +4033,7 @@ characters." | |||
| 4025 | (list t error-file) | 4033 | (list t error-file) |
| 4026 | t))) | 4034 | t))) |
| 4027 | ;; It is rude to delete a buffer that the command is not using. | 4035 | ;; It is rude to delete a buffer that the command is not using. |
| 4028 | ;; (let ((shell-buffer (get-buffer "*Shell Command Output*"))) | 4036 | ;; (let ((shell-buffer (get-buffer shell-command-buffer-name))) |
| 4029 | ;; (and shell-buffer (not (eq shell-buffer (current-buffer))) | 4037 | ;; (and shell-buffer (not (eq shell-buffer (current-buffer))) |
| 4030 | ;; (kill-buffer shell-buffer))) | 4038 | ;; (kill-buffer shell-buffer))) |
| 4031 | ;; Don't muck with mark unless REPLACE says we should. | 4039 | ;; Don't muck with mark unless REPLACE says we should. |
| @@ -4033,12 +4041,13 @@ characters." | |||
| 4033 | ;; No prefix argument: put the output in a temp buffer, | 4041 | ;; No prefix argument: put the output in a temp buffer, |
| 4034 | ;; replacing its entire contents. | 4042 | ;; replacing its entire contents. |
| 4035 | (let ((buffer (get-buffer-create | 4043 | (let ((buffer (get-buffer-create |
| 4036 | (or output-buffer "*Shell Command Output*")))) | 4044 | (or output-buffer shell-command-buffer-name)))) |
| 4037 | (set-buffer-major-mode buffer) ; Enable globalized modes (bug#38111) | 4045 | (set-buffer-major-mode buffer) ; Enable globalized modes (bug#38111) |
| 4038 | (unwind-protect | 4046 | (unwind-protect |
| 4039 | (if (and (eq buffer (current-buffer)) | 4047 | (if (and (eq buffer (current-buffer)) |
| 4040 | (or (memq shell-command-dont-erase-buffer '(nil erase)) | 4048 | (or (memq shell-command-dont-erase-buffer '(nil erase)) |
| 4041 | (and (not (eq buffer (get-buffer "*Shell Command Output*"))) | 4049 | (and (not (eq buffer (get-buffer |
| 4050 | shell-command-buffer-name))) | ||
| 4042 | (not (region-active-p))))) | 4051 | (not (region-active-p))))) |
| 4043 | ;; If the input is the same buffer as the output, | 4052 | ;; If the input is the same buffer as the output, |
| 4044 | ;; delete everything but the specified region, | 4053 | ;; delete everything but the specified region, |