Commit df9b56ec authored by Juri Linkov's avatar Juri Linkov
Browse files

Rename shell-command-width to async-shell-command-width (bug#35055)

* lisp/simple.el (async-shell-command-width):
* lisp/net/tramp.el (tramp-handle-shell-command):
* test/lisp/net/tramp-tests.el (tramp-test32-shell-command):
* doc/misc/tramp.texi (Remote processes): Rename this variable.

* doc/emacs/misc.texi (Single Shell): Add async-shell-command-width.
parent 81487bf8
Pipeline #1579 failed with stage
in 57 minutes and 2 seconds
...@@ -775,6 +775,13 @@ documentation for more possibilities. ...@@ -775,6 +775,13 @@ documentation for more possibilities.
displayed only when the command generates output, set displayed only when the command generates output, set
@code{async-shell-command-display-buffer} to @code{nil}. @code{async-shell-command-display-buffer} to @code{nil}.
@vindex async-shell-command-width
The option @code{async-shell-command-width} defines the number of display
columns available for output of asynchronous shell commands.
A positive integer tells the shell to use that number of columns for
command output. The default value is @code{nil} that means to use
the same number of columns as provided by the shell.
@kindex M-| @kindex M-|
@findex shell-command-on-region @findex shell-command-on-region
@kbd{M-|} (@code{shell-command-on-region}) is like @kbd{M-!}, but @kbd{M-|} (@code{shell-command-on-region}) is like @kbd{M-!}, but
......
...@@ -3093,9 +3093,9 @@ uses @file{/system/bin/sh}). Like the variables in the previous ...@@ -3093,9 +3093,9 @@ uses @file{/system/bin/sh}). Like the variables in the previous
section, these variables can be changed via connection-local section, these variables can be changed via connection-local
variables. variables.
@vindex shell-command-width @vindex async-shell-command-width
@vindex COLUMNS@r{, environment variable} @vindex COLUMNS@r{, environment variable}
If Emacs supports the variable @code{shell-command-width} (since Emacs If Emacs supports the variable @code{async-shell-command-width} (since Emacs
27.1), @value{tramp} cares about its value for asynchronous shell 27.1), @value{tramp} cares about its value for asynchronous shell
commands. It specifies the number of display columns for command commands. It specifies the number of display columns for command
output. For synchronous shell commands, a similar effect can be output. For synchronous shell commands, a similar effect can be
......
...@@ -1119,8 +1119,8 @@ variable for remote shells. It still defaults to "/bin/sh". ...@@ -1119,8 +1119,8 @@ variable for remote shells. It still defaults to "/bin/sh".
** Single shell commands ** Single shell commands
--- ---
*** 'shell-command-width' defines the number of display columns *** 'async-shell-command-width' defines the number of display columns
available for output of asynchronous or remote shell commands. available for output of asynchronous shell commands.
** Pcomplete ** Pcomplete
......
...@@ -3640,10 +3640,10 @@ support symbolic links." ...@@ -3640,10 +3640,10 @@ support symbolic links."
(if (and (not current-buffer-p) (integerp asynchronous)) (if (and (not current-buffer-p) (integerp asynchronous))
(let ((tramp-remote-process-environment (let ((tramp-remote-process-environment
;; `shell-command-width' has been introduced with Emacs 27.1. ;; `async-shell-command-width' has been introduced with Emacs 27.1.
(if (natnump (bound-and-true-p shell-command-width)) (if (natnump (bound-and-true-p async-shell-command-width))
(cons (format "COLUMNS=%d" (cons (format "COLUMNS=%d"
(bound-and-true-p shell-command-width)) (bound-and-true-p async-shell-command-width))
tramp-remote-process-environment) tramp-remote-process-environment)
tramp-remote-process-environment))) tramp-remote-process-environment)))
(prog1 (prog1
......
...@@ -3353,7 +3353,7 @@ is output." ...@@ -3353,7 +3353,7 @@ is output."
:group 'shell :group 'shell
:version "26.1") :version "26.1")
(defcustom shell-command-width nil (defcustom async-shell-command-width nil
"Number of display columns available for asynchronous shell command output. "Number of display columns available for asynchronous shell command output.
If nil, use the shell default number (usually 80 columns). If nil, use the shell default number (usually 80 columns).
If a positive integer, tell the shell to use that number of columns for If a positive integer, tell the shell to use that number of columns for
...@@ -3627,8 +3627,8 @@ impose the use of a shell (with its need to quote arguments)." ...@@ -3627,8 +3627,8 @@ impose the use of a shell (with its need to quote arguments)."
(shell-command--save-pos-or-erase) (shell-command--save-pos-or-erase)
(setq default-directory directory) (setq default-directory directory)
(let ((process-environment (let ((process-environment
(if (natnump shell-command-width) (if (natnump async-shell-command-width)
(cons (format "COLUMNS=%d" shell-command-width) (cons (format "COLUMNS=%d" async-shell-command-width)
process-environment) process-environment)
process-environment))) process-environment)))
(setq proc (setq proc
......
...@@ -4192,18 +4192,17 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." ...@@ -4192,18 +4192,17 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
;; Cleanup. ;; Cleanup.
(ignore-errors (delete-file tmp-name))) (ignore-errors (delete-file tmp-name)))
;; Test `shell-command-width' of `async-shell-command'. ;; Test `async-shell-command-width'. Since Emacs 27.1.
;; Since Emacs 27.1. (when (and (boundp 'async-shell-command-width)
(when (and (boundp 'shell-command-width)
(zerop (call-process "tput" nil nil nil "cols")) (zerop (call-process "tput" nil nil nil "cols"))
(zerop (process-file "tput" nil nil nil "cols"))) (zerop (process-file "tput" nil nil nil "cols")))
(let (shell-command-width) (let (async-shell-command-width)
(should (should
(string-equal (string-equal
(format "%s\n" (car (process-lines "tput" "cols"))) (format "%s\n" (car (process-lines "tput" "cols")))
(tramp--test-shell-command-to-string-asynchronously (tramp--test-shell-command-to-string-asynchronously
"tput cols"))) "tput cols")))
(setq shell-command-width 1024) (setq async-shell-command-width 1024)
(should (should
(string-equal (string-equal
"1024\n" "1024\n"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment