diff options
| author | Michael Albinus | 2012-08-17 11:18:18 +0200 |
|---|---|---|
| committer | Michael Albinus | 2012-08-17 11:18:18 +0200 |
| commit | 4a6bc3fd94e5b4199fd960180853304162e6b8f4 (patch) | |
| tree | c706eb873b71ba24a2955514f59683073c8f4ad5 | |
| parent | 383dcbf97748f1a4ef57f8af4f5780501ba78216 (diff) | |
| download | emacs-4a6bc3fd94e5b4199fd960180853304162e6b8f4.tar.gz emacs-4a6bc3fd94e5b4199fd960180853304162e6b8f4.zip | |
* net/tramp-sh.el (tramp-sh-handle-start-file-process): Eliminate
superfluous prompt. (Bug#12203)
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/net/tramp-sh.el | 75 |
2 files changed, 49 insertions, 31 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8fa6b4c6b47..6be54850414 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-08-17 Michael Albinus <michael.albinus@gmx.de> | ||
| 2 | |||
| 3 | * net/tramp-sh.el (tramp-sh-handle-start-file-process): Eliminate | ||
| 4 | superfluous prompt. (Bug#12203) | ||
| 5 | |||
| 1 | 2012-08-17 Chong Yidong <cyd@gnu.org> | 6 | 2012-08-17 Chong Yidong <cyd@gnu.org> |
| 2 | 7 | ||
| 3 | * mouse.el (mouse-appearance-menu): If x-select-font returns a | 8 | * mouse.el (mouse-appearance-menu): If x-select-font returns a |
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index e757247c2a2..6283188d46a 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el | |||
| @@ -2738,51 +2738,64 @@ the result will be a local, non-Tramp, filename." | |||
| 2738 | (bmp (and (buffer-live-p buffer) (buffer-modified-p buffer))) | 2738 | (bmp (and (buffer-live-p buffer) (buffer-modified-p buffer))) |
| 2739 | (name1 name) | 2739 | (name1 name) |
| 2740 | (i 0)) | 2740 | (i 0)) |
| 2741 | (unwind-protect | 2741 | |
| 2742 | (save-excursion | 2742 | (unless buffer |
| 2743 | (save-restriction | 2743 | ;; BUFFER can be nil. We use a temporary buffer. |
| 2744 | (unless buffer | 2744 | (setq buffer (generate-new-buffer tramp-temp-buffer-name))) |
| 2745 | ;; BUFFER can be nil. We use a temporary buffer. | 2745 | (while (get-process name1) |
| 2746 | (setq buffer (generate-new-buffer tramp-temp-buffer-name))) | 2746 | ;; NAME must be unique as process name. |
| 2747 | (while (get-process name1) | 2747 | (setq i (1+ i) |
| 2748 | ;; NAME must be unique as process name. | 2748 | name1 (format "%s<%d>" name i))) |
| 2749 | (setq i (1+ i) | 2749 | (setq name name1) |
| 2750 | name1 (format "%s<%d>" name i))) | 2750 | ;; Set the new process properties. |
| 2751 | (setq name name1) | 2751 | (tramp-set-connection-property v "process-name" name) |
| 2752 | ;; Set the new process properties. | 2752 | (tramp-set-connection-property v "process-buffer" buffer) |
| 2753 | (tramp-set-connection-property v "process-name" name) | 2753 | |
| 2754 | (tramp-set-connection-property v "process-buffer" buffer) | 2754 | (with-current-buffer (tramp-get-connection-buffer v) |
| 2755 | ;; Activate narrowing in order to save BUFFER contents. | 2755 | (unwind-protect |
| 2756 | ;; Clear also the modification time; otherwise we might | 2756 | (save-excursion |
| 2757 | ;; be interrupted by `verify-visited-file-modtime'. | 2757 | (save-restriction |
| 2758 | (with-current-buffer (tramp-get-connection-buffer v) | 2758 | ;; Activate narrowing in order to save BUFFER |
| 2759 | (let ((buffer-undo-list t)) | 2759 | ;; contents. Clear also the modification time; |
| 2760 | ;; otherwise we might be interrupted by | ||
| 2761 | ;; `verify-visited-file-modtime'. | ||
| 2762 | (let ((buffer-undo-list t) | ||
| 2763 | (buffer-read-only nil) | ||
| 2764 | (mark (point))) | ||
| 2760 | (clear-visited-file-modtime) | 2765 | (clear-visited-file-modtime) |
| 2761 | (narrow-to-region (point-max) (point-max)) | 2766 | (narrow-to-region (point-max) (point-max)) |
| 2767 | ;; We call `tramp-maybe-open-connection', in order | ||
| 2768 | ;; to cleanup the prompt afterwards. | ||
| 2769 | (tramp-maybe-open-connection v) | ||
| 2770 | (widen) | ||
| 2771 | (delete-region mark (point)) | ||
| 2772 | (narrow-to-region (point-max) (point-max)) | ||
| 2773 | ;; Now do it. | ||
| 2762 | (if command | 2774 | (if command |
| 2763 | ;; Send the command. | 2775 | ;; Send the command. |
| 2764 | (tramp-send-command v command nil t) ; nooutput | 2776 | (tramp-send-command v command nil t) ; nooutput |
| 2765 | ;; Check, whether a pty is associated. | 2777 | ;; Check, whether a pty is associated. |
| 2766 | (tramp-maybe-open-connection v) | ||
| 2767 | (unless (tramp-compat-process-get | 2778 | (unless (tramp-compat-process-get |
| 2768 | (tramp-get-connection-process v) 'remote-tty) | 2779 | (tramp-get-connection-process v) 'remote-tty) |
| 2769 | (tramp-error | 2780 | (tramp-error |
| 2770 | v 'file-error | 2781 | v 'file-error |
| 2771 | "pty association is not supported for `%s'" name))))) | 2782 | "pty association is not supported for `%s'" name)))) |
| 2772 | (let ((p (tramp-get-connection-process v))) | 2783 | (let ((p (tramp-get-connection-process v))) |
| 2773 | ;; Set query flag for this process. | 2784 | ;; Set query flag for this process. We ignore errors, |
| 2774 | (tramp-compat-set-process-query-on-exit-flag p t) | 2785 | ;; because the process could have finished already. |
| 2775 | ;; Return process. | 2786 | (ignore-errors |
| 2776 | p))) | 2787 | (tramp-compat-set-process-query-on-exit-flag p t)) |
| 2777 | ;; Save exit. | 2788 | ;; Return process. |
| 2778 | (with-current-buffer (tramp-get-connection-buffer v) | 2789 | p))) |
| 2790 | |||
| 2791 | ;; Save exit. | ||
| 2779 | (if (string-match tramp-temp-buffer-name (buffer-name)) | 2792 | (if (string-match tramp-temp-buffer-name (buffer-name)) |
| 2780 | (progn | 2793 | (progn |
| 2781 | (set-process-buffer (tramp-get-connection-process v) nil) | 2794 | (set-process-buffer (tramp-get-connection-process v) nil) |
| 2782 | (kill-buffer (current-buffer))) | 2795 | (kill-buffer (current-buffer))) |
| 2783 | (set-buffer-modified-p bmp))) | 2796 | (set-buffer-modified-p bmp)) |
| 2784 | (tramp-set-connection-property v "process-name" nil) | 2797 | (tramp-set-connection-property v "process-name" nil) |
| 2785 | (tramp-set-connection-property v "process-buffer" nil))))) | 2798 | (tramp-set-connection-property v "process-buffer" nil)))))) |
| 2786 | 2799 | ||
| 2787 | (defun tramp-sh-handle-process-file | 2800 | (defun tramp-sh-handle-process-file |
| 2788 | (program &optional infile destination display &rest args) | 2801 | (program &optional infile destination display &rest args) |