diff options
| author | Michael Albinus | 2013-02-12 15:35:10 +0100 |
|---|---|---|
| committer | Michael Albinus | 2013-02-12 15:35:10 +0100 |
| commit | f1f0587100316d5d7f622fb01d73f97e0c060d55 (patch) | |
| tree | 60ed7e313cdbdf1138730b595440dbf263d78661 | |
| parent | 957a6f2652fc543c58d74aca237041cd6e0fe2fa (diff) | |
| download | emacs-f1f0587100316d5d7f622fb01d73f97e0c060d55.tar.gz emacs-f1f0587100316d5d7f622fb01d73f97e0c060d55.zip | |
* net/tramp-adb.el (tramp-adb-handle-start-file-process): Rewrite.
* net/tramp-compat.el (top): Declare `remote-file-name-inhibit-cache'
only if it doesn't exist.
* net/tramp-sh.el (tramp-sh-handle-start-file-process): Set
process marker.
| -rw-r--r-- | lisp/ChangeLog | 10 | ||||
| -rw-r--r-- | lisp/net/tramp-adb.el | 96 | ||||
| -rw-r--r-- | lisp/net/tramp-compat.el | 3 | ||||
| -rw-r--r-- | lisp/net/tramp-sh.el | 8 |
4 files changed, 82 insertions, 35 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3dd163f0612..18c11debf0d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2013-02-12 Michael Albinus <michael.albinus@gmx.de> | ||
| 2 | |||
| 3 | * net/tramp-adb.el (tramp-adb-handle-start-file-process): Rewrite. | ||
| 4 | |||
| 5 | * net/tramp-compat.el (top): Declare `remote-file-name-inhibit-cache' | ||
| 6 | only if it doesn't exist. | ||
| 7 | |||
| 8 | * net/tramp-sh.el (tramp-sh-handle-start-file-process): Set | ||
| 9 | process marker. | ||
| 10 | |||
| 1 | 2013-02-12 Tassilo Horn <tsdh@gnu.org> | 11 | 2013-02-12 Tassilo Horn <tsdh@gnu.org> |
| 2 | 12 | ||
| 3 | * doc-view.el (doc-view-odf->pdf-converter-soffice): Use separate | 13 | * doc-view.el (doc-view-odf->pdf-converter-soffice): Use separate |
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index 17802d39fa4..0974c62c56e 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el | |||
| @@ -902,42 +902,76 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." | |||
| 902 | (defun tramp-adb-handle-start-file-process (name buffer program &rest args) | 902 | (defun tramp-adb-handle-start-file-process (name buffer program &rest args) |
| 903 | "Like `start-file-process' for Tramp files." | 903 | "Like `start-file-process' for Tramp files." |
| 904 | (with-parsed-tramp-file-name default-directory nil | 904 | (with-parsed-tramp-file-name default-directory nil |
| 905 | ;; When PROGRAM is nil, we just provide a tty. | 905 | ;; When PROGRAM is nil, we should provide a tty. This is not |
| 906 | ;; possible here. | ||
| 907 | (unless (stringp program) | ||
| 908 | (tramp-error v 'file-error "PROGRAM must be a string")) | ||
| 909 | |||
| 906 | (let ((command | 910 | (let ((command |
| 907 | (when (stringp program) | 911 | (format "cd %s; %s" |
| 908 | (format "cd %s; %s" | 912 | (tramp-shell-quote-argument localname) |
| 909 | (tramp-shell-quote-argument localname) | 913 | (mapconcat 'tramp-shell-quote-argument |
| 910 | (mapconcat 'tramp-shell-quote-argument | 914 | (cons program args) " "))) |
| 911 | (cons program args) " ")))) | ||
| 912 | (tramp-process-connection-type | 915 | (tramp-process-connection-type |
| 913 | (or (null program) tramp-process-connection-type)) | 916 | (or (null program) tramp-process-connection-type)) |
| 917 | (bmp (and (buffer-live-p buffer) (buffer-modified-p buffer))) | ||
| 914 | (name1 name) | 918 | (name1 name) |
| 915 | (i 0)) | 919 | (i 0)) |
| 916 | (unwind-protect | 920 | |
| 917 | (save-excursion | 921 | (unless buffer |
| 918 | (save-restriction | 922 | ;; BUFFER can be nil. We use a temporary buffer. |
| 919 | (while (get-process name1) | 923 | (setq buffer (generate-new-buffer tramp-temp-buffer-name))) |
| 920 | ;; NAME must be unique as process name. | 924 | (while (get-process name1) |
| 921 | (setq i (1+ i) | 925 | ;; NAME must be unique as process name. |
| 922 | name1 (format "%s<%d>" name i))) | 926 | (setq i (1+ i) |
| 923 | (setq name name1) | 927 | name1 (format "%s<%d>" name i))) |
| 924 | ;; Set the new process properties. | 928 | (setq name name1) |
| 925 | (tramp-set-connection-property v "process-name" name) | 929 | ;; Set the new process properties. |
| 926 | (when command | 930 | (tramp-set-connection-property v "process-name" name) |
| 927 | (let* ((host (tramp-file-name-host v)) | 931 | (tramp-set-connection-property v "process-buffer" buffer) |
| 928 | (devices (mapcar 'cadr (tramp-adb-parse-device-names nil))) | 932 | |
| 929 | (args (if (> (length host) 0) | 933 | (with-current-buffer (tramp-get-connection-buffer v) |
| 930 | (list "-s" host "shell" command) | 934 | (unwind-protect |
| 931 | (list "shell" command))) | 935 | ;; We catch this event. Otherwise, `start-process' could |
| 932 | (p (apply 'start-process (tramp-get-connection-name v) buffer | 936 | ;; be called on the local host. |
| 933 | (tramp-adb-program) args))) | 937 | (save-excursion |
| 934 | ;; Set sentinel and query flag for this process. | 938 | (save-restriction |
| 935 | (tramp-set-connection-property p "vector" v) | 939 | ;; Activate narrowing in order to save BUFFER |
| 936 | (set-process-sentinel p 'tramp-process-sentinel) | 940 | ;; contents. Clear also the modification time; |
| 937 | (tramp-compat-set-process-query-on-exit-flag p t) | 941 | ;; otherwise we might be interrupted by |
| 938 | ;; Return process. | 942 | ;; `verify-visited-file-modtime'. |
| 939 | p)))) | 943 | (let ((buffer-undo-list t) |
| 940 | (tramp-set-connection-property v "process-name" nil))))) | 944 | (buffer-read-only nil) |
| 945 | (mark (point))) | ||
| 946 | (clear-visited-file-modtime) | ||
| 947 | (narrow-to-region (point-max) (point-max)) | ||
| 948 | ;; We call `tramp-adb-maybe-open-connection', in | ||
| 949 | ;; order to cleanup the prompt afterwards. | ||
| 950 | (tramp-adb-maybe-open-connection v) | ||
| 951 | (widen) | ||
| 952 | (delete-region mark (point)) | ||
| 953 | (narrow-to-region (point-max) (point-max)) | ||
| 954 | ;; Send the command. | ||
| 955 | (let ((tramp-adb-prompt (regexp-quote command))) | ||
| 956 | (tramp-adb-send-command v command)) | ||
| 957 | (let ((p (tramp-get-connection-process v))) | ||
| 958 | ;; Set query flag and process marker for this | ||
| 959 | ;; process. We ignore errors, because the process | ||
| 960 | ;; could have finished already. | ||
| 961 | (ignore-errors | ||
| 962 | (tramp-compat-set-process-query-on-exit-flag p t) | ||
| 963 | (set-marker (process-mark p) (point))) | ||
| 964 | ;; Return process. | ||
| 965 | p)))) | ||
| 966 | |||
| 967 | ;; Save exit. | ||
| 968 | (if (string-match tramp-temp-buffer-name (buffer-name)) | ||
| 969 | (ignore-errors | ||
| 970 | (set-process-buffer (tramp-get-connection-process v) nil) | ||
| 971 | (kill-buffer (current-buffer))) | ||
| 972 | (set-buffer-modified-p bmp)) | ||
| 973 | (tramp-set-connection-property v "process-name" nil) | ||
| 974 | (tramp-set-connection-property v "process-buffer" nil)))))) | ||
| 941 | 975 | ||
| 942 | ;; Helper functions. | 976 | ;; Helper functions. |
| 943 | 977 | ||
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index 00ef43b1a66..12510bf7fab 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el | |||
| @@ -96,7 +96,8 @@ | |||
| 96 | ;; `remote-file-name-inhibit-cache' has been introduced with Emacs 24.1. | 96 | ;; `remote-file-name-inhibit-cache' has been introduced with Emacs 24.1. |
| 97 | ;; Besides `t', `nil', and integer, we use also timestamps (as | 97 | ;; Besides `t', `nil', and integer, we use also timestamps (as |
| 98 | ;; returned by `current-time') internally. | 98 | ;; returned by `current-time') internally. |
| 99 | (defvar remote-file-name-inhibit-cache nil) | 99 | (unless (boundp 'remote-file-name-inhibit-cache) |
| 100 | (defvar remote-file-name-inhibit-cache nil)) | ||
| 100 | 101 | ||
| 101 | ;; For not existing functions, or functions with a changed argument | 102 | ;; For not existing functions, or functions with a changed argument |
| 102 | ;; list, there are compiler warnings. We want to avoid them in | 103 | ;; list, there are compiler warnings. We want to avoid them in |
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index bfa145ac780..0c2a0aa385a 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el | |||
| @@ -2856,10 +2856,12 @@ the result will be a local, non-Tramp, filename." | |||
| 2856 | v 'file-error | 2856 | v 'file-error |
| 2857 | "pty association is not supported for `%s'" name)))) | 2857 | "pty association is not supported for `%s'" name)))) |
| 2858 | (let ((p (tramp-get-connection-process v))) | 2858 | (let ((p (tramp-get-connection-process v))) |
| 2859 | ;; Set query flag for this process. We ignore errors, | 2859 | ;; Set query flag and process marker for this |
| 2860 | ;; because the process could have finished already. | 2860 | ;; process. We ignore errors, because the process |
| 2861 | ;; could have finished already. | ||
| 2861 | (ignore-errors | 2862 | (ignore-errors |
| 2862 | (tramp-compat-set-process-query-on-exit-flag p t)) | 2863 | (tramp-compat-set-process-query-on-exit-flag p t) |
| 2864 | (set-marker (process-mark p) (point))) | ||
| 2863 | ;; Return process. | 2865 | ;; Return process. |
| 2864 | p)))) | 2866 | p)))) |
| 2865 | 2867 | ||