emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 3a34f57: * lisp/simple.el (shell-command-width): Ne


From: Juri Linkov
Subject: [Emacs-diffs] master 3a34f57: * lisp/simple.el (shell-command-width): New defcustom.
Date: Sat, 13 Apr 2019 17:46:47 -0400 (EDT)

branch: master
commit 3a34f57c7e7ba355c1271c815213fb9c526b27f3
Author: Juri Linkov <address@hidden>
Commit: Juri Linkov <address@hidden>

    * lisp/simple.el (shell-command-width): New defcustom.
    
    (shell-command): Use it.  (Bug#35055)
---
 etc/NEWS       |  5 +++++
 lisp/simple.el | 18 ++++++++++++++++--
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 021d7d0..d34fb3b 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1064,6 +1064,11 @@ followed when Emacs writes the relevant history 
variables to the disk.
 *** The variable 'shell-file-name' can be set now as connection-local
 variable for remote shells.  It still defaults to "/bin/sh".
 
+** Single shell commands
+
+*** 'shell-command-width' defines the number of output columns
+for asynchronous shell command.
+
 ** Pcomplete
 
 *** The function 'pcomplete-uniquify-list' has been renamed from
diff --git a/lisp/simple.el b/lisp/simple.el
index 37f9254..017ba51 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -3351,6 +3351,15 @@ is output."
   :group 'shell
   :version "26.1")
 
+(defcustom shell-command-width nil
+  "Number of columns available for asynchronous shell command output.
+If nil, use the shell default number (usually 80 columns).
+If a positive integer, use a fixed width for command output."
+  :type '(choice (const :tag "Use system limit" nil)
+                 (integer :tag "Fixed width" :value 80))
+  :group 'shell
+  :version "27.1")
+
 (defcustom shell-command-dont-erase-buffer nil
   "If non-nil, output buffer is not erased between shell commands.
 Also, a non-nil value sets the point in the output buffer
@@ -3614,8 +3623,13 @@ impose the use of a shell (with its need to quote 
arguments)."
                (with-current-buffer buffer
                   (shell-command--save-pos-or-erase)
                  (setq default-directory directory)
-                  (setq proc
-                        (start-process-shell-command "Shell" buffer command))
+                 (let ((process-environment
+                        (if (natnump shell-command-width)
+                            (cons (format "COLUMNS=%d" shell-command-width)
+                                  process-environment)
+                          process-environment)))
+                   (setq proc
+                         (start-process-shell-command "Shell" buffer command)))
                  (setq mode-line-process '(":%s"))
                  (require 'shell) (shell-mode)
                   (set-process-sentinel proc #'shell-command-sentinel)



reply via email to

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