]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix Bug#35055
authorMichael Albinus <michael.albinus@gmx.de>
Sun, 14 Apr 2019 17:52:12 +0000 (19:52 +0200)
committerMichael Albinus <michael.albinus@gmx.de>
Sun, 14 Apr 2019 17:52:12 +0000 (19:52 +0200)
* lisp/net/tramp.el (tramp-handle-shell-command):
Handle `shell-command-width'.  (Bug#35055)

lisp/net/tramp.el

index 32963ac54322c38de1d4198769a1b87a68a955d5..2e1a0960d7dfd8772127d8825dd7ac90f33a7d2a 100644 (file)
@@ -3638,17 +3638,24 @@ support symbolic links."
        (erase-buffer)))
 
     (if (and (not current-buffer-p) (integerp asynchronous))
-       (prog1
-           ;; Run the process.
-           (setq p (start-file-process-shell-command
-                    (buffer-name output-buffer) buffer command))
-         ;; Display output.
-         (with-current-buffer output-buffer
-           (display-buffer output-buffer '(nil (allow-no-window . t)))
-           (setq mode-line-process '(":%s"))
-           (shell-mode)
-           (set-process-sentinel p #'shell-command-sentinel)
-           (set-process-filter p #'comint-output-filter)))
+       (let ((tramp-remote-process-environment
+              ;; `shell-command-width' has been introduced with Emacs 27.1.
+              (if (natnump (bound-and-true-p shell-command-width))
+                  (cons (format "COLUMNS=%d"
+                                (bound-and-true-p shell-command-width))
+                        tramp-remote-process-environment)
+                tramp-remote-process-environment)))
+         (prog1
+             ;; Run the process.
+             (setq p (start-file-process-shell-command
+                      (buffer-name output-buffer) buffer command))
+           ;; Display output.
+           (with-current-buffer output-buffer
+             (display-buffer output-buffer '(nil (allow-no-window . t)))
+             (setq mode-line-process '(":%s"))
+             (shell-mode)
+             (set-process-sentinel p #'shell-command-sentinel)
+             (set-process-filter p #'comint-output-filter))))
 
       (prog1
          ;; Run the process.