Commit c6deabaf authored by Michael Albinus's avatar Michael Albinus
Browse files

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.
parent 8093e82e
......@@ -235,6 +235,12 @@ If NAME is a remote file name, the local part of NAME is unquoted."
((eq tramp-syntax 'sep) 'separate)
(t tramp-syntax)))
;; `cl-struct-slot-info' has been introduced with Emacs 25.
(defmacro tramp-compat-tramp-file-name-slots ()
(if (fboundp 'cl-struct-slot-info)
`(cdr (mapcar 'car (cl-struct-slot-info 'tramp-file-name)))
`(cdr (mapcar 'car (get 'tramp-file-name 'cl-struct-slots)))))
(provide 'tramp-compat)
;;; TODO:
......@@ -1760,9 +1760,7 @@ If VAR is nil, then we bind `v' to the structure and `method', `user',
`(,(if var (intern (format "%s-%s" var elem)) elem)
(,(intern (format "tramp-file-name-%s" elem))
,(or var 'v))))
(mapcar 'car (cl-struct-slot-info 'tramp-file-name)))))))
`(let* ((,(or var 'v) (tramp-dissect-file-name ,filename))
;; We don't know which of those vars will be used, so we bind them all,
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment