diff options
| author | Andreas Schwab | 2008-08-13 19:33:36 +0000 |
|---|---|---|
| committer | Andreas Schwab | 2008-08-13 19:33:36 +0000 |
| commit | f34db3167f6d743f86d85cd4adfa439e5bdfb1e8 (patch) | |
| tree | e5d9578d45569ccd02744b4c405332278099c49a /lisp/net | |
| parent | 5d2ebd96ecaa30e227674cb6bb0dd9ede7b50987 (diff) | |
| download | emacs-f34db3167f6d743f86d85cd4adfa439e5bdfb1e8.tar.gz emacs-f34db3167f6d743f86d85cd4adfa439e5bdfb1e8.zip | |
(tramp-handle-shell-command): Handle output going
to current buffer like shell-command. Don't disable undo.
Diffstat (limited to 'lisp/net')
| -rw-r--r-- | lisp/net/tramp.el | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 67e679b2ef3..828c1d2442f 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -3878,7 +3878,10 @@ Lisp error raised when PROGRAM is nil is trapped also, returning 1." | |||
| 3878 | (error nil)) | 3878 | (error nil)) |
| 3879 | (error "Shell command in progress"))) | 3879 | (error "Shell command in progress"))) |
| 3880 | 3880 | ||
| 3881 | (unless current-buffer-p | 3881 | (if current-buffer-p |
| 3882 | (progn | ||
| 3883 | (barf-if-buffer-read-only) | ||
| 3884 | (push-mark nil t)) | ||
| 3882 | (with-current-buffer output-buffer | 3885 | (with-current-buffer output-buffer |
| 3883 | (setq buffer-read-only nil) | 3886 | (setq buffer-read-only nil) |
| 3884 | (erase-buffer))) | 3887 | (erase-buffer))) |
| @@ -3900,12 +3903,20 @@ Lisp error raised when PROGRAM is nil is trapped also, returning 1." | |||
| 3900 | (with-current-buffer error-buffer | 3903 | (with-current-buffer error-buffer |
| 3901 | (insert-file-contents (cadr buffer))) | 3904 | (insert-file-contents (cadr buffer))) |
| 3902 | (delete-file (cadr buffer))) | 3905 | (delete-file (cadr buffer))) |
| 3903 | ;; There's some output, display it. | 3906 | (if current-buffer-p |
| 3904 | (when (with-current-buffer output-buffer (> (point-max) (point-min))) | 3907 | ;; This is like exchange-point-and-mark, but doesn't |
| 3905 | (if (functionp 'display-message-or-buffer) | 3908 | ;; activate the mark. It is cleaner to avoid activation, |
| 3906 | (funcall (symbol-function 'display-message-or-buffer) | 3909 | ;; even though the command loop would deactivate the mark |
| 3907 | output-buffer) | 3910 | ;; because we inserted text. |
| 3908 | (pop-to-buffer output-buffer))))))) | 3911 | (goto-char (prog1 (mark t) |
| 3912 | (set-marker (mark-marker) (point) | ||
| 3913 | (current-buffer)))) | ||
| 3914 | ;; There's some output, display it. | ||
| 3915 | (when (with-current-buffer output-buffer (> (point-max) (point-min))) | ||
| 3916 | (if (functionp 'display-message-or-buffer) | ||
| 3917 | (funcall (symbol-function 'display-message-or-buffer) | ||
| 3918 | output-buffer) | ||
| 3919 | (pop-to-buffer output-buffer)))))))) | ||
| 3909 | 3920 | ||
| 3910 | ;; File Editing. | 3921 | ;; File Editing. |
| 3911 | 3922 | ||