diff options
| author | Michael Albinus | 2013-01-06 16:44:18 +0100 |
|---|---|---|
| committer | Michael Albinus | 2013-01-06 16:44:18 +0100 |
| commit | b6cfbcd0fcd40fd41112477b62f1d819ee3d2998 (patch) | |
| tree | cf7360259d2de76e44c608105f5b0ce8c906f549 | |
| parent | 58ba7b1b558e4803100905bd5fff0004e4ddd261 (diff) | |
| download | emacs-b6cfbcd0fcd40fd41112477b62f1d819ee3d2998.tar.gz emacs-b6cfbcd0fcd40fd41112477b62f1d819ee3d2998.zip | |
* net/tramp-adb.el (tramp-adb-ls-toolbox-regexp): The file size can
consist of mor than one digit.
(tramp-adb-file-name-handler-alist): Use
`tramp-handle-file-exists-p' consistently.
(tramp-adb-file-name-handler): Don't tweak `tramp-default-host'.
(tramp-adb-handle-file-exists-p): Remove function.
(tramp-adb-file-name-host): New defun.
(tramp-adb-execute-adb-command, tramp-adb-maybe-open-connection):
Use it.
(tramp-adb-maybe-open-connection): Set "remote-path" property.
| -rw-r--r-- | lisp/ChangeLog | 13 | ||||
| -rw-r--r-- | lisp/net/tramp-adb.el | 59 |
2 files changed, 45 insertions, 27 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index fe3c252c306..59c7e7a14a0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,16 @@ | |||
| 1 | 2013-01-06 Michael Albinus <michael.albinus@gmx.de> | ||
| 2 | |||
| 3 | * net/tramp-adb.el (tramp-adb-ls-toolbox-regexp): The file size can | ||
| 4 | consist of mor than one digit. | ||
| 5 | (tramp-adb-file-name-handler-alist): Use | ||
| 6 | `tramp-handle-file-exists-p' consistently. | ||
| 7 | (tramp-adb-file-name-handler): Don't tweak `tramp-default-host'. | ||
| 8 | (tramp-adb-handle-file-exists-p): Remove function. | ||
| 9 | (tramp-adb-file-name-host): New defun. | ||
| 10 | (tramp-adb-execute-adb-command, tramp-adb-maybe-open-connection): | ||
| 11 | Use it. | ||
| 12 | (tramp-adb-maybe-open-connection): Set "remote-path" property. | ||
| 13 | |||
| 1 | 2013-01-06 Chong Yidong <cyd@gnu.org> | 14 | 2013-01-06 Chong Yidong <cyd@gnu.org> |
| 2 | 15 | ||
| 3 | * vc/vc.el (vc-next-action): Detect buffer modifications | 16 | * vc/vc.el (vc-next-action): Detect buffer modifications |
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index fd8fdb51796..13e17ed3cdc 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el | |||
| @@ -61,7 +61,7 @@ | |||
| 61 | "^[[:space:]]*\\([-[:alpha:]]+\\)" ; \1 permissions | 61 | "^[[:space:]]*\\([-[:alpha:]]+\\)" ; \1 permissions |
| 62 | "[[:space:]]*\\([^[:space:]]+\\)" ; \2 username | 62 | "[[:space:]]*\\([^[:space:]]+\\)" ; \2 username |
| 63 | "[[:space:]]+\\([^[:space:]]+\\)" ; \3 group | 63 | "[[:space:]]+\\([^[:space:]]+\\)" ; \3 group |
| 64 | "[[:space:]]+\\([[:digit:]]\\)" ; \4 size | 64 | "[[:space:]]+\\([[:digit:]]+\\)" ; \4 size |
| 65 | "[[:space:]]+\\([-[:digit:]]+[[:space:]][:[:digit:]]+\\)" ; \5 date | 65 | "[[:space:]]+\\([-[:digit:]]+[[:space:]][:[:digit:]]+\\)" ; \5 date |
| 66 | "[[:space:]]+\\(.*\\)$")) ; \6 filename | 66 | "[[:space:]]+\\(.*\\)$")) ; \6 filename |
| 67 | 67 | ||
| @@ -95,8 +95,8 @@ | |||
| 95 | (file-directory-p . tramp-adb-handle-file-directory-p) | 95 | (file-directory-p . tramp-adb-handle-file-directory-p) |
| 96 | (file-symlink-p . tramp-handle-file-symlink-p) | 96 | (file-symlink-p . tramp-handle-file-symlink-p) |
| 97 | ;; FIXME: This is too sloppy. | 97 | ;; FIXME: This is too sloppy. |
| 98 | (file-executable-p . file-exists-p) | 98 | (file-executable-p . tramp-handle-file-exists-p) |
| 99 | (file-exists-p . tramp-adb-handle-file-exists-p) | 99 | (file-exists-p . tramp-handle-file-exists-p) |
| 100 | (file-readable-p . tramp-handle-file-exists-p) | 100 | (file-readable-p . tramp-handle-file-exists-p) |
| 101 | (file-writable-p . tramp-adb-handle-file-writable-p) | 101 | (file-writable-p . tramp-adb-handle-file-writable-p) |
| 102 | (file-local-copy . tramp-adb-handle-file-local-copy) | 102 | (file-local-copy . tramp-adb-handle-file-local-copy) |
| @@ -139,13 +139,7 @@ | |||
| 139 | "Invoke the ADB handler for OPERATION. | 139 | "Invoke the ADB handler for OPERATION. |
| 140 | First arg specifies the OPERATION, second arg is a list of arguments to | 140 | First arg specifies the OPERATION, second arg is a list of arguments to |
| 141 | pass to the OPERATION." | 141 | pass to the OPERATION." |
| 142 | (let ((fn (assoc operation tramp-adb-file-name-handler-alist)) | 142 | (let ((fn (assoc operation tramp-adb-file-name-handler-alist))) |
| 143 | ;; `tramp-default-host's default value is (system-name). Not | ||
| 144 | ;; useful for us. | ||
| 145 | (tramp-default-host | ||
| 146 | (unless (equal (eval (car (get 'tramp-default-host 'standard-value))) | ||
| 147 | tramp-default-host) | ||
| 148 | tramp-default-host))) | ||
| 149 | (if fn | 143 | (if fn |
| 150 | (save-match-data (apply (cdr fn) args)) | 144 | (save-match-data (apply (cdr fn) args)) |
| 151 | (tramp-run-real-handler operation args)))) | 145 | (tramp-run-real-handler operation args)))) |
| @@ -940,20 +934,19 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." | |||
| 940 | (tramp-set-connection-property v "process-name" nil) | 934 | (tramp-set-connection-property v "process-name" nil) |
| 941 | (tramp-set-connection-property v "process-buffer" nil))))) | 935 | (tramp-set-connection-property v "process-buffer" nil))))) |
| 942 | 936 | ||
| 943 | ;; Android < 4 doesn't provide test command. | ||
| 944 | |||
| 945 | (defun tramp-adb-handle-file-exists-p (filename) | ||
| 946 | "Like `file-exists-p' for Tramp files." | ||
| 947 | (with-parsed-tramp-file-name filename nil | ||
| 948 | (with-tramp-file-property v localname "file-exists-p" | ||
| 949 | (file-attributes filename)))) | ||
| 950 | |||
| 951 | ;; Helper functions. | 937 | ;; Helper functions. |
| 952 | 938 | ||
| 939 | (defun tramp-adb-file-name-host (vec) | ||
| 940 | "Return host component of VEC. | ||
| 941 | If it is equal to the default value of `tramp-default-host', `nil' is returned." | ||
| 942 | (let ((host (tramp-file-name-host vec))) | ||
| 943 | (unless (equal host (eval (car (get 'tramp-default-host 'standard-value)))) | ||
| 944 | host))) | ||
| 945 | |||
| 953 | (defun tramp-adb-execute-adb-command (vec &rest args) | 946 | (defun tramp-adb-execute-adb-command (vec &rest args) |
| 954 | "Returns nil on success error-output on failure." | 947 | "Returns nil on success error-output on failure." |
| 955 | (when (tramp-file-name-host vec) | 948 | (when (tramp-adb-file-name-host vec) |
| 956 | (setq args (append (list "-s" (tramp-file-name-host vec)) args))) | 949 | (setq args (append (list "-s" (tramp-adb-file-name-host vec)) args))) |
| 957 | (with-temp-buffer | 950 | (with-temp-buffer |
| 958 | (prog1 | 951 | (prog1 |
| 959 | (unless (zerop (apply 'call-process (tramp-adb-program) nil t nil args)) | 952 | (unless (zerop (apply 'call-process (tramp-adb-program) nil t nil args)) |
| @@ -1061,21 +1054,21 @@ connection if a previous connection has died for some reason." | |||
| 1061 | (when (and p (processp p)) (delete-process p)) | 1054 | (when (and p (processp p)) (delete-process p)) |
| 1062 | (if (not devices) | 1055 | (if (not devices) |
| 1063 | (tramp-error vec 'file-error "No device connected")) | 1056 | (tramp-error vec 'file-error "No device connected")) |
| 1064 | (if (and (tramp-file-name-host vec) | 1057 | (if (and (tramp-adb-file-name-host vec) |
| 1065 | (not (member (tramp-file-name-host vec) devices))) | 1058 | (not (member (tramp-adb-file-name-host vec) devices))) |
| 1066 | (tramp-error | 1059 | (tramp-error |
| 1067 | vec 'file-error | 1060 | vec 'file-error |
| 1068 | "Device %s not connected" (tramp-file-name-host vec))) | 1061 | "Device %s not connected" (tramp-adb-file-name-host vec))) |
| 1069 | (if (and (not (eq (length devices) 1)) | 1062 | (if (and (not (eq (length devices) 1)) |
| 1070 | (not (tramp-file-name-host vec))) | 1063 | (not (tramp-adb-file-name-host vec))) |
| 1071 | (tramp-error | 1064 | (tramp-error |
| 1072 | vec 'file-error | 1065 | vec 'file-error |
| 1073 | "Multiple Devices connected: No Host/Device specified")) | 1066 | "Multiple Devices connected: No Host/Device specified")) |
| 1074 | (with-tramp-progress-reporter vec 3 "Opening adb shell connection" | 1067 | (with-tramp-progress-reporter vec 3 "Opening adb shell connection" |
| 1075 | (let* ((coding-system-for-read 'utf-8-dos) ;is this correct? | 1068 | (let* ((coding-system-for-read 'utf-8-dos) ;is this correct? |
| 1076 | (process-connection-type tramp-process-connection-type) | 1069 | (process-connection-type tramp-process-connection-type) |
| 1077 | (args (if (tramp-file-name-host vec) | 1070 | (args (if (tramp-adb-file-name-host vec) |
| 1078 | (list "-s" (tramp-file-name-host vec) "shell") | 1071 | (list "-s" (tramp-adb-file-name-host vec) "shell") |
| 1079 | (list "shell"))) | 1072 | (list "shell"))) |
| 1080 | (p (let ((default-directory | 1073 | (p (let ((default-directory |
| 1081 | (tramp-compat-temporary-file-directory))) | 1074 | (tramp-compat-temporary-file-directory))) |
| @@ -1111,7 +1104,19 @@ connection if a previous connection has died for some reason." | |||
| 1111 | vec 3 | 1104 | vec 3 |
| 1112 | "Connection reset, because remote host changed from `%s' to `%s'" | 1105 | "Connection reset, because remote host changed from `%s' to `%s'" |
| 1113 | old-getprop new-getprop) | 1106 | old-getprop new-getprop) |
| 1114 | (tramp-adb-maybe-open-connection vec))))))))) | 1107 | (tramp-adb-maybe-open-connection vec))) |
| 1108 | |||
| 1109 | ;; Set "remote-path" connection property. This is needed | ||
| 1110 | ;; for eshell. | ||
| 1111 | (tramp-adb-send-command vec "echo \\\"$PATH\\\"") | ||
| 1112 | (tramp-set-connection-property | ||
| 1113 | vec "remote-path" | ||
| 1114 | (split-string | ||
| 1115 | (with-current-buffer (tramp-get-connection-buffer vec) | ||
| 1116 | ;; Read the expression. | ||
| 1117 | (goto-char (point-min)) | ||
| 1118 | (read (current-buffer))) | ||
| 1119 | ":" 'omit-nulls)))))))) | ||
| 1115 | 1120 | ||
| 1116 | (provide 'tramp-adb) | 1121 | (provide 'tramp-adb) |
| 1117 | ;;; tramp-adb.el ends here | 1122 | ;;; tramp-adb.el ends here |