aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/net
diff options
context:
space:
mode:
authorAndreas Schwab2008-08-13 19:09:10 +0000
committerAndreas Schwab2008-08-13 19:09:10 +0000
commit5d2ebd96ecaa30e227674cb6bb0dd9ede7b50987 (patch)
treecde7d09fc4d6f54bc53919f4c20bed24780dab48 /lisp/net
parentc1043701f647fefd3975bc05191308e09edd42a4 (diff)
downloademacs-5d2ebd96ecaa30e227674cb6bb0dd9ede7b50987.tar.gz
emacs-5d2ebd96ecaa30e227674cb6bb0dd9ede7b50987.zip
(tramp-handle-shell-command): Correctly handle
output going to current buffer. Don't disable undo.
Diffstat (limited to 'lisp/net')
-rw-r--r--lisp/net/tramp.el15
1 files changed, 9 insertions, 6 deletions
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 8c836aea4fa..67e679b2ef3 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -3846,11 +3846,14 @@ Lisp error raised when PROGRAM is nil is trapped also, returning 1."
3846 ;; We cannot use `shell-file-name' and `shell-command-switch', 3846 ;; We cannot use `shell-file-name' and `shell-command-switch',
3847 ;; they are variables of the local host. 3847 ;; they are variables of the local host.
3848 (args (list "/bin/sh" "-c" (substring command 0 asynchronous))) 3848 (args (list "/bin/sh" "-c" (substring command 0 asynchronous)))
3849 current-buffer-p
3849 (output-buffer 3850 (output-buffer
3850 (cond 3851 (cond
3851 ((bufferp output-buffer) output-buffer) 3852 ((bufferp output-buffer) output-buffer)
3852 ((stringp output-buffer) (get-buffer-create output-buffer)) 3853 ((stringp output-buffer) (get-buffer-create output-buffer))
3853 (output-buffer (current-buffer)) 3854 (output-buffer
3855 (setq current-buffer-p t)
3856 (current-buffer))
3854 (t (get-buffer-create 3857 (t (get-buffer-create
3855 (if asynchronous 3858 (if asynchronous
3856 "*Async Shell Command*" 3859 "*Async Shell Command*"
@@ -3875,12 +3878,12 @@ Lisp error raised when PROGRAM is nil is trapped also, returning 1."
3875 (error nil)) 3878 (error nil))
3876 (error "Shell command in progress"))) 3879 (error "Shell command in progress")))
3877 3880
3878 (with-current-buffer output-buffer 3881 (unless current-buffer-p
3879 (setq buffer-read-only nil 3882 (with-current-buffer output-buffer
3880 buffer-undo-list t) 3883 (setq buffer-read-only nil)
3881 (erase-buffer)) 3884 (erase-buffer)))
3882 3885
3883 (if (integerp asynchronous) 3886 (if (and (not current-buffer-p) (integerp asynchronous))
3884 (prog1 3887 (prog1
3885 ;; Run the process. 3888 ;; Run the process.
3886 (apply 'start-file-process "*Async Shell*" buffer args) 3889 (apply 'start-file-process "*Async Shell*" buffer args)