bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#35055: 27.0.50; async-shell-command truncates output lines


From: Juri Linkov
Subject: bug#35055: 27.0.50; async-shell-command truncates output lines
Date: Thu, 02 May 2019 00:07:21 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)

>>>> There is no need for the new option to be consistent across
>>>> both synchronous and async/remote operations.
>>>
>>> Call it `async-shell-command-width', that's it. Nobody has asked for the
>>> synchronous case.
>>
>> Yes, this is a safer option.
>
> Do you still plan to use that name? As said, I believe it is the better
> one. Nobody has opposed the last ten days.
>
> And, btw, this option still needs to be documented in the Emacs manual.

Do you agree with this change?

diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi
index 7d7065a441..c61e98df89 100644
--- a/doc/emacs/misc.texi
+++ b/doc/emacs/misc.texi
@@ -775,6 +775,13 @@ Single Shell
 displayed only when the command generates output, set
 @code{async-shell-command-display-buffer} to @code{nil}.
 
address@hidden async-shell-command-width
+  The option @code{async-shell-command-width} defines the number of display
+columns available for output of asynchronous or remote 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-|
 @findex shell-command-on-region
   @kbd{M-|} (@code{shell-command-on-region}) is like @kbd{M-!}, but
diff --git a/etc/NEWS b/etc/NEWS
index 9e3559d27e..ebbbea7567 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1103,7 +1103,7 @@ variable for remote shells.  It still defaults to 
"/bin/sh".
 ** 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.
 
 ** Pcomplete
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 2e1a0960d7..c0446b79a7 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -3639,10 +3639,10 @@ tramp-handle-shell-command
 
     (if (and (not current-buffer-p) (integerp asynchronous))
        (let ((tramp-remote-process-environment
-              ;; `shell-command-width' has been introduced with Emacs 27.1.
-              (if (natnump (bound-and-true-p shell-command-width))
+              ;; `async-shell-command-width' has been introduced with Emacs 
27.1.
+              (if (natnump (bound-and-true-p async-shell-command-width))
                   (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)))
          (prog1
diff --git a/lisp/simple.el b/lisp/simple.el
index acea1f9ddc..f93882d9bd 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -3353,8 +3353,8 @@ async-shell-command-display-buffer
   :group 'shell
   :version "26.1")
 
-(defcustom shell-command-width nil
-  "Number of display columns available for asynchronous shell command output.
+(defcustom async-shell-command-width nil
+  "Number of display columns available for asynchronous/remote shell command.
 If nil, use the shell default number (usually 80 columns).
 If a positive integer, tell the shell to use that number of columns for
 command output."
@@ -3627,8 +3627,8 @@ shell-command
                   (shell-command--save-pos-or-erase)
                  (setq default-directory directory)
                  (let ((process-environment
-                        (if (natnump shell-command-width)
-                            (cons (format "COLUMNS=%d" shell-command-width)
+                        (if (natnump async-shell-command-width)
+                            (cons (format "COLUMNS=%d" 
async-shell-command-width)
                                   process-environment)
                           process-environment)))
                    (setq proc
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index cba697da18..2c82b99691 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -4192,18 +4192,18 @@ tramp--test-shell-command-to-string-asynchronously
        ;; Cleanup.
        (ignore-errors (delete-file tmp-name)))
 
-      ;; Test `shell-command-width' of `async-shell-command'.
+      ;; Test `async-shell-command-width' of `async-shell-command'.
       ;; Since Emacs 27.1.
-      (when (and (boundp 'shell-command-width)
+      (when (and (boundp 'async-shell-command-width)
                 (zerop (call-process "tput" nil nil nil "cols"))
                  (zerop (process-file "tput" nil nil nil "cols")))
-       (let (shell-command-width)
+       (let (async-shell-command-width)
          (should
           (string-equal
            (format "%s\n" (car (process-lines "tput" "cols")))
            (tramp--test-shell-command-to-string-asynchronously
             "tput cols")))
-         (setq shell-command-width 1024)
+         (setq async-shell-command-width 1024)
          (should
           (string-equal
            "1024\n"

reply via email to

[Prev in Thread] Current Thread [Next in Thread]