Commit f34db316 authored by Andreas Schwab's avatar Andreas Schwab
Browse files

(tramp-handle-shell-command): Handle output going

to current buffer like shell-command.  Don't disable undo.
parent 5d2ebd96
2008-08-13 Andreas Schwab <schwab@suse.de> 2008-08-13 Andreas Schwab <schwab@suse.de>
* net/tramp.el (tramp-handle-shell-command): Correctly handle * net/tramp.el (tramp-handle-shell-command): Handle output going
output going to current buffer. Don't disable undo. to current buffer like shell-command. Don't disable undo.
2008-08-13 Glenn Morris <rgm@gnu.org> 2008-08-13 Glenn Morris <rgm@gnu.org>
......
...@@ -3878,7 +3878,10 @@ Lisp error raised when PROGRAM is nil is trapped also, returning 1." ...@@ -3878,7 +3878,10 @@ Lisp error raised when PROGRAM is nil is trapped also, returning 1."
(error nil)) (error nil))
(error "Shell command in progress"))) (error "Shell command in progress")))
(unless current-buffer-p (if current-buffer-p
(progn
(barf-if-buffer-read-only)
(push-mark nil t))
(with-current-buffer output-buffer (with-current-buffer output-buffer
(setq buffer-read-only nil) (setq buffer-read-only nil)
(erase-buffer))) (erase-buffer)))
...@@ -3900,12 +3903,20 @@ Lisp error raised when PROGRAM is nil is trapped also, returning 1." ...@@ -3900,12 +3903,20 @@ Lisp error raised when PROGRAM is nil is trapped also, returning 1."
(with-current-buffer error-buffer (with-current-buffer error-buffer
(insert-file-contents (cadr buffer))) (insert-file-contents (cadr buffer)))
(delete-file (cadr buffer))) (delete-file (cadr buffer)))
;; There's some output, display it. (if current-buffer-p
(when (with-current-buffer output-buffer (> (point-max) (point-min))) ;; This is like exchange-point-and-mark, but doesn't
(if (functionp 'display-message-or-buffer) ;; activate the mark. It is cleaner to avoid activation,
(funcall (symbol-function 'display-message-or-buffer) ;; even though the command loop would deactivate the mark
output-buffer) ;; because we inserted text.
(pop-to-buffer output-buffer))))))) (goto-char (prog1 (mark t)
(set-marker (mark-marker) (point)
(current-buffer))))
;; There's some output, display it.
(when (with-current-buffer output-buffer (> (point-max) (point-min)))
(if (functionp 'display-message-or-buffer)
(funcall (symbol-function 'display-message-or-buffer)
output-buffer)
(pop-to-buffer output-buffer))))))))
;; File Editing. ;; File Editing.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment