diff options
| author | Michael Albinus | 2018-11-28 16:38:49 +0100 |
|---|---|---|
| committer | Michael Albinus | 2018-11-28 16:38:49 +0100 |
| commit | 9b9c70b7dbaa001d2f78a15fd1f3aaa8fce44eef (patch) | |
| tree | cfa695721fbefaa5dbe0366e349288d2905fd814 | |
| parent | 1ca436a33c7de612e44409841d6bed0fe6268141 (diff) | |
| download | emacs-9b9c70b7dbaa001d2f78a15fd1f3aaa8fce44eef.tar.gz emacs-9b9c70b7dbaa001d2f78a15fd1f3aaa8fce44eef.zip | |
Tramp cleanup
* lisp/net/tramp-sh.el (tramp-sh-handle-file-name-all-completions)
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-name-all-completions):
* lisp/net/tramp-smb.el (tramp-smb-read-file-entry):
Use `string-match-p'.
* lisp/net/tramp-rclone.el (tramp-rclone-maybe-open-connection):
Set file properties more robust.
* lisp/net/tramp-sh.el (tramp-stat-marker)
(tramp-convert-file-attributes): Add tramp-autoload cookie.
| -rw-r--r-- | lisp/net/tramp-cache.el | 12 | ||||
| -rw-r--r-- | lisp/net/tramp-gvfs.el | 2 | ||||
| -rw-r--r-- | lisp/net/tramp-rclone.el | 17 | ||||
| -rw-r--r-- | lisp/net/tramp-sh.el | 4 | ||||
| -rw-r--r-- | lisp/net/tramp-smb.el | 6 |
5 files changed, 26 insertions, 15 deletions
diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el index ebb4254dab4..51a8f13c4a4 100644 --- a/lisp/net/tramp-cache.el +++ b/lisp/net/tramp-cache.el | |||
| @@ -28,7 +28,7 @@ | |||
| 28 | ;; An implementation of information caching for remote files. | 28 | ;; An implementation of information caching for remote files. |
| 29 | 29 | ||
| 30 | ;; Each connection, identified by a `tramp-file-name' structure or by | 30 | ;; Each connection, identified by a `tramp-file-name' structure or by |
| 31 | ;; a process, has a unique cache. We distinguish 3 kind of caches, | 31 | ;; a process, has a unique cache. We distinguish 4 kind of caches, |
| 32 | ;; depending on the key: | 32 | ;; depending on the key: |
| 33 | ;; | 33 | ;; |
| 34 | ;; - localname is NIL. This are reusable properties. Examples: | 34 | ;; - localname is NIL. This are reusable properties. Examples: |
| @@ -49,6 +49,16 @@ | |||
| 49 | ;; an open connection. Examples: "scripts" keeps shell script | 49 | ;; an open connection. Examples: "scripts" keeps shell script |
| 50 | ;; definitions already sent to the remote shell, "last-cmd-time" is | 50 | ;; definitions already sent to the remote shell, "last-cmd-time" is |
| 51 | ;; the time stamp a command has been sent to the remote process. | 51 | ;; the time stamp a command has been sent to the remote process. |
| 52 | ;; | ||
| 53 | ;; - The key is `nil'. This are temporary properties related to the | ||
| 54 | ;; local machine. Examples: "parse-passwd" and "parse-group" keep | ||
| 55 | ;; the results of parsing "/etc/passwd" and "/etc/group", "locale" | ||
| 56 | ;; is the used shell locale. | ||
| 57 | |||
| 58 | ;; Some properties are handled special: | ||
| 59 | ;; | ||
| 60 | ;; - "process-name", "process-buffer" and "first-password-request" are | ||
| 61 | ;; not saved in the file `tramp-persistency-file-name'. | ||
| 52 | 62 | ||
| 53 | ;;; Code: | 63 | ;;; Code: |
| 54 | 64 | ||
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index 9d53edd0843..76747f7c993 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el | |||
| @@ -1143,7 +1143,7 @@ If FILE-SYSTEM is non-nil, return file system attributes." | |||
| 1143 | 1143 | ||
| 1144 | (defun tramp-gvfs-handle-file-name-all-completions (filename directory) | 1144 | (defun tramp-gvfs-handle-file-name-all-completions (filename directory) |
| 1145 | "Like `file-name-all-completions' for Tramp files." | 1145 | "Like `file-name-all-completions' for Tramp files." |
| 1146 | (unless (save-match-data (string-match "/" filename)) | 1146 | (unless (string-match-p "/" filename) |
| 1147 | (all-completions | 1147 | (all-completions |
| 1148 | filename | 1148 | filename |
| 1149 | (with-parsed-tramp-file-name (expand-file-name directory) nil | 1149 | (with-parsed-tramp-file-name (expand-file-name directory) nil |
diff --git a/lisp/net/tramp-rclone.el b/lisp/net/tramp-rclone.el index 3ca857dc3be..6c01d7def1a 100644 --- a/lisp/net/tramp-rclone.el +++ b/lisp/net/tramp-rclone.el | |||
| @@ -518,15 +518,14 @@ connection if a previous connection has died for some reason." | |||
| 518 | 518 | ||
| 519 | ;; In `tramp-check-cached-permissions', the connection properties | 519 | ;; In `tramp-check-cached-permissions', the connection properties |
| 520 | ;; {uig,gid}-{integer,string} are used. We set them to proper values. | 520 | ;; {uig,gid}-{integer,string} are used. We set them to proper values. |
| 521 | (unless (tramp-get-connection-property vec "uid-integer" nil) | 521 | (with-tramp-connection-property |
| 522 | (tramp-set-connection-property | 522 | vec "uid-integer" (tramp-get-local-uid 'integer)) |
| 523 | vec "uid-integer" (tramp-get-local-uid 'integer)) | 523 | (with-tramp-connection-property |
| 524 | (tramp-set-connection-property | 524 | vec "gid-integer" (tramp-get-local-gid 'integer)) |
| 525 | vec "gid-integer" (tramp-get-local-gid 'integer)) | 525 | (with-tramp-connection-property |
| 526 | (tramp-set-connection-property | 526 | vec "uid-string" (tramp-get-local-uid 'string)) |
| 527 | vec "uid-string" (tramp-get-local-uid 'string)) | 527 | (with-tramp-connection-property |
| 528 | (tramp-set-connection-property | 528 | vec "gid-string" (tramp-get-local-gid 'string))) |
| 529 | vec "gid-string" (tramp-get-local-gid 'string)))) | ||
| 530 | 529 | ||
| 531 | (defun tramp-rclone-send-command (vec &rest args) | 530 | (defun tramp-rclone-send-command (vec &rest args) |
| 532 | "Send the COMMAND to connection VEC." | 531 | "Send the COMMAND to connection VEC." |
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index b5d4893580e..900b4b3c277 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el | |||
| @@ -945,6 +945,7 @@ od -v -t x1 -A n </dev/null && \ | |||
| 945 | busybox awk '{}' </dev/null" | 945 | busybox awk '{}' </dev/null" |
| 946 | "Test command for checking `tramp-awk-encode' and `tramp-awk-decode'.") | 946 | "Test command for checking `tramp-awk-encode' and `tramp-awk-decode'.") |
| 947 | 947 | ||
| 948 | ;;;###tramp-autoload | ||
| 948 | (defconst tramp-stat-marker "/////" | 949 | (defconst tramp-stat-marker "/////" |
| 949 | "Marker in stat commands for file attributes.") | 950 | "Marker in stat commands for file attributes.") |
| 950 | 951 | ||
| @@ -1838,7 +1839,7 @@ be non-negative integers." | |||
| 1838 | ;; files. | 1839 | ;; files. |
| 1839 | (defun tramp-sh-handle-file-name-all-completions (filename directory) | 1840 | (defun tramp-sh-handle-file-name-all-completions (filename directory) |
| 1840 | "Like `file-name-all-completions' for Tramp files." | 1841 | "Like `file-name-all-completions' for Tramp files." |
| 1841 | (unless (save-match-data (string-match "/" filename)) | 1842 | (unless (string-match-p "/" filename) |
| 1842 | (all-completions | 1843 | (all-completions |
| 1843 | filename | 1844 | filename |
| 1844 | (with-parsed-tramp-file-name (expand-file-name directory) nil | 1845 | (with-parsed-tramp-file-name (expand-file-name directory) nil |
| @@ -5114,6 +5115,7 @@ raises an error." | |||
| 5114 | "`%s' does not return a valid Lisp expression: `%s'" | 5115 | "`%s' does not return a valid Lisp expression: `%s'" |
| 5115 | command (buffer-string)))))))) | 5116 | command (buffer-string)))))))) |
| 5116 | 5117 | ||
| 5118 | ;;;###tramp-autoload | ||
| 5117 | (defun tramp-convert-file-attributes (vec attr) | 5119 | (defun tramp-convert-file-attributes (vec attr) |
| 5118 | "Convert `file-attributes' ATTR generated by perl script, stat or ls. | 5120 | "Convert `file-attributes' ATTR generated by perl script, stat or ls. |
| 5119 | Convert file mode bits to string and set virtual device number. | 5121 | Convert file mode bits to string and set virtual device number. |
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index 23b5176b528..a49dbbdb39a 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el | |||
| @@ -1796,12 +1796,12 @@ Result is the list (LOCALNAME MODE SIZE MTIME)." | |||
| 1796 | (if (string-match "\\([ACDEHNORrsSTV]+\\)?$" line) | 1796 | (if (string-match "\\([ACDEHNORrsSTV]+\\)?$" line) |
| 1797 | (setq | 1797 | (setq |
| 1798 | mode (or (match-string 1 line) "") | 1798 | mode (or (match-string 1 line) "") |
| 1799 | mode (save-match-data (format | 1799 | mode (format |
| 1800 | "%s%s" | 1800 | "%s%s" |
| 1801 | (if (string-match "D" mode) "d" "-") | 1801 | (if (string-match-p "D" mode) "d" "-") |
| 1802 | (mapconcat | 1802 | (mapconcat |
| 1803 | (lambda (_x) "") " " | 1803 | (lambda (_x) "") " " |
| 1804 | (concat "r" (if (string-match "R" mode) "-" "w") "x")))) | 1804 | (concat "r" (if (string-match "R" mode) "-" "w") "x"))) |
| 1805 | line (substring line 0 -6)) | 1805 | line (substring line 0 -6)) |
| 1806 | (cl-return)) | 1806 | (cl-return)) |
| 1807 | 1807 | ||