diff options
| author | Michael Albinus | 2017-10-23 14:05:49 +0200 |
|---|---|---|
| committer | Michael Albinus | 2017-10-23 14:05:49 +0200 |
| commit | c6deabaf4d77fb3ed137c0dbabf98a420cc5c7f9 (patch) | |
| tree | 8abf856be805de23e70d9ba0f0646357706e8d0f | |
| parent | 8093e82e429d598d72ae7e51d4a2d5a49d98902e (diff) | |
| download | emacs-c6deabaf4d77fb3ed137c0dbabf98a420cc5c7f9.tar.gz emacs-c6deabaf4d77fb3ed137c0dbabf98a420cc5c7f9.zip | |
Improve Tramp backward compatibility
* lisp/net/tramp-compat.el (tramp-compat-tramp-file-name-slots):
New defmacro.
* lisp/net/tramp.el (with-parsed-tramp-file-name): Use it.
| -rw-r--r-- | lisp/net/tramp-compat.el | 6 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index 214ad040a17..9326f7b1864 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el | |||
| @@ -235,6 +235,12 @@ If NAME is a remote file name, the local part of NAME is unquoted." | |||
| 235 | ((eq tramp-syntax 'sep) 'separate) | 235 | ((eq tramp-syntax 'sep) 'separate) |
| 236 | (t tramp-syntax))) | 236 | (t tramp-syntax))) |
| 237 | 237 | ||
| 238 | ;; `cl-struct-slot-info' has been introduced with Emacs 25. | ||
| 239 | (defmacro tramp-compat-tramp-file-name-slots () | ||
| 240 | (if (fboundp 'cl-struct-slot-info) | ||
| 241 | `(cdr (mapcar 'car (cl-struct-slot-info 'tramp-file-name))) | ||
| 242 | `(cdr (mapcar 'car (get 'tramp-file-name 'cl-struct-slots))))) | ||
| 243 | |||
| 238 | (provide 'tramp-compat) | 244 | (provide 'tramp-compat) |
| 239 | 245 | ||
| 240 | ;;; TODO: | 246 | ;;; TODO: |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 3d6934783f5..5a59dd622dd 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -1760,9 +1760,7 @@ If VAR is nil, then we bind `v' to the structure and `method', `user', | |||
| 1760 | `(,(if var (intern (format "%s-%s" var elem)) elem) | 1760 | `(,(if var (intern (format "%s-%s" var elem)) elem) |
| 1761 | (,(intern (format "tramp-file-name-%s" elem)) | 1761 | (,(intern (format "tramp-file-name-%s" elem)) |
| 1762 | ,(or var 'v)))) | 1762 | ,(or var 'v)))) |
| 1763 | (eval-and-compile | 1763 | `,(tramp-compat-tramp-file-name-slots)))) |
| 1764 | (cdr | ||
| 1765 | (mapcar 'car (cl-struct-slot-info 'tramp-file-name))))))) | ||
| 1766 | `(let* ((,(or var 'v) (tramp-dissect-file-name ,filename)) | 1764 | `(let* ((,(or var 'v) (tramp-dissect-file-name ,filename)) |
| 1767 | ,@bindings) | 1765 | ,@bindings) |
| 1768 | ;; We don't know which of those vars will be used, so we bind them all, | 1766 | ;; We don't know which of those vars will be used, so we bind them all, |