# HG changeset patch # User Andreas Schwab # Date 1218654550 0 # Node ID 85c2adddd7659e746734005cff6677f04faa31ac # Parent 34df0af1cb93425a27a09a20a19369f173dc0515 (tramp-handle-shell-command): Correctly handle output going to current buffer. Don't disable undo. diff -r 34df0af1cb93 -r 85c2adddd765 lisp/ChangeLog --- a/lisp/ChangeLog Wed Aug 13 03:12:49 2008 +0000 +++ b/lisp/ChangeLog Wed Aug 13 19:09:10 2008 +0000 @@ -1,3 +1,8 @@ +2008-08-13 Andreas Schwab + + * net/tramp.el (tramp-handle-shell-command): Correctly handle + output going to current buffer. Don't disable undo. + 2008-08-13 Glenn Morris * eshell/esh-cmd.el (eshell/which): Handle the case where no description diff -r 34df0af1cb93 -r 85c2adddd765 lisp/net/tramp.el --- a/lisp/net/tramp.el Wed Aug 13 03:12:49 2008 +0000 +++ b/lisp/net/tramp.el Wed Aug 13 19:09:10 2008 +0000 @@ -3846,11 +3846,14 @@ ;; We cannot use `shell-file-name' and `shell-command-switch', ;; they are variables of the local host. (args (list "/bin/sh" "-c" (substring command 0 asynchronous))) + current-buffer-p (output-buffer (cond ((bufferp output-buffer) output-buffer) ((stringp output-buffer) (get-buffer-create output-buffer)) - (output-buffer (current-buffer)) + (output-buffer + (setq current-buffer-p t) + (current-buffer)) (t (get-buffer-create (if asynchronous "*Async Shell Command*" @@ -3875,12 +3878,12 @@ (error nil)) (error "Shell command in progress"))) - (with-current-buffer output-buffer - (setq buffer-read-only nil - buffer-undo-list t) - (erase-buffer)) - - (if (integerp asynchronous) + (unless current-buffer-p + (with-current-buffer output-buffer + (setq buffer-read-only nil) + (erase-buffer))) + + (if (and (not current-buffer-p) (integerp asynchronous)) (prog1 ;; Run the process. (apply 'start-file-process "*Async Shell*" buffer args)