]> git.eshelyaron.com Git - emacs.git/commitdiff
(tramp-handle-shell-command): Correctly handle
authorAndreas Schwab <schwab@suse.de>
Wed, 13 Aug 2008 19:09:10 +0000 (19:09 +0000)
committerAndreas Schwab <schwab@suse.de>
Wed, 13 Aug 2008 19:09:10 +0000 (19:09 +0000)
output going to current buffer.  Don't disable undo.

lisp/ChangeLog
lisp/net/tramp.el

index 8426b30789e17021a9eef585a3ceb80cebcdf823..1401f4b8cd81abbe7ed9c9e52c63038e2e86c3a2 100644 (file)
@@ -1,3 +1,8 @@
+2008-08-13  Andreas Schwab  <schwab@suse.de>
+
+       * net/tramp.el (tramp-handle-shell-command): Correctly handle
+       output going to current buffer.  Don't disable undo.
+
 2008-08-13  Glenn Morris  <rgm@gnu.org>
 
        * eshell/esh-cmd.el (eshell/which): Handle the case where no description
index 8c836aea4fa18c38ebb29cff987890fda2eca81e..67e679b2ef36ffd31d08aa6d0c39256e011a9381 100644 (file)
@@ -3846,11 +3846,14 @@ Lisp error raised when PROGRAM is nil is trapped also, returning 1."
         ;; 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 @@ Lisp error raised when PROGRAM is nil is trapped also, returning 1."
            (error nil))
        (error "Shell command in progress")))
 
-    (with-current-buffer output-buffer
-      (setq buffer-read-only nil
-           buffer-undo-list t)
-      (erase-buffer))
+    (unless current-buffer-p
+      (with-current-buffer output-buffer
+       (setq buffer-read-only nil)
+       (erase-buffer)))
 
-    (if (integerp asynchronous)
+    (if (and (not current-buffer-p) (integerp asynchronous))
        (prog1
            ;; Run the process.
            (apply 'start-file-process "*Async Shell*" buffer args)