aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2019-04-14 00:46:38 +0300
committerJuri Linkov2019-04-14 00:46:38 +0300
commit3a34f57c7e7ba355c1271c815213fb9c526b27f3 (patch)
treeefc1946d2ea3c54661e22cc1173de13efa880f67
parentad652a3b89848394a3613206082f233101b91f60 (diff)
downloademacs-3a34f57c7e7ba355c1271c815213fb9c526b27f3.tar.gz
emacs-3a34f57c7e7ba355c1271c815213fb9c526b27f3.zip
* lisp/simple.el (shell-command-width): New defcustom.
(shell-command): Use it. (Bug#35055)
-rw-r--r--etc/NEWS5
-rw-r--r--lisp/simple.el18
2 files changed, 21 insertions, 2 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 021d7d01799..d34fb3bb12a 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1064,6 +1064,11 @@ followed when Emacs writes the relevant history variables to the disk.
1064*** The variable 'shell-file-name' can be set now as connection-local 1064*** The variable 'shell-file-name' can be set now as connection-local
1065variable for remote shells. It still defaults to "/bin/sh". 1065variable for remote shells. It still defaults to "/bin/sh".
1066 1066
1067** Single shell commands
1068
1069*** 'shell-command-width' defines the number of output columns
1070for asynchronous shell command.
1071
1067** Pcomplete 1072** Pcomplete
1068 1073
1069*** The function 'pcomplete-uniquify-list' has been renamed from 1074*** The function 'pcomplete-uniquify-list' has been renamed from
diff --git a/lisp/simple.el b/lisp/simple.el
index 37f92540dde..017ba510007 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -3351,6 +3351,15 @@ is output."
3351 :group 'shell 3351 :group 'shell
3352 :version "26.1") 3352 :version "26.1")
3353 3353
3354(defcustom shell-command-width nil
3355 "Number of columns available for asynchronous shell command output.
3356If nil, use the shell default number (usually 80 columns).
3357If a positive integer, use a fixed width for command output."
3358 :type '(choice (const :tag "Use system limit" nil)
3359 (integer :tag "Fixed width" :value 80))
3360 :group 'shell
3361 :version "27.1")
3362
3354(defcustom shell-command-dont-erase-buffer nil 3363(defcustom shell-command-dont-erase-buffer nil
3355 "If non-nil, output buffer is not erased between shell commands. 3364 "If non-nil, output buffer is not erased between shell commands.
3356Also, a non-nil value sets the point in the output buffer 3365Also, 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)."
3614 (with-current-buffer buffer 3623 (with-current-buffer buffer
3615 (shell-command--save-pos-or-erase) 3624 (shell-command--save-pos-or-erase)
3616 (setq default-directory directory) 3625 (setq default-directory directory)
3617 (setq proc 3626 (let ((process-environment
3618 (start-process-shell-command "Shell" buffer command)) 3627 (if (natnump shell-command-width)
3628 (cons (format "COLUMNS=%d" shell-command-width)
3629 process-environment)
3630 process-environment)))
3631 (setq proc
3632 (start-process-shell-command "Shell" buffer command)))
3619 (setq mode-line-process '(":%s")) 3633 (setq mode-line-process '(":%s"))
3620 (require 'shell) (shell-mode) 3634 (require 'shell) (shell-mode)
3621 (set-process-sentinel proc #'shell-command-sentinel) 3635 (set-process-sentinel proc #'shell-command-sentinel)