emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-26 c6deaba: Improve Tramp backward compatibility


From: Michael Albinus
Subject: [Emacs-diffs] emacs-26 c6deaba: Improve Tramp backward compatibility
Date: Mon, 23 Oct 2017 08:05:56 -0400 (EDT)

branch: emacs-26
commit c6deabaf4d77fb3ed137c0dbabf98a420cc5c7f9
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    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.
---
 lisp/net/tramp-compat.el | 6 ++++++
 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 214ad04..9326f7b 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."
        ((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:
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 3d69347..5a59dd6 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',
                    `(,(if var (intern (format "%s-%s" var elem)) elem)
                      (,(intern (format "tramp-file-name-%s" elem))
                       ,(or var 'v))))
-                 (eval-and-compile
-                   (cdr
-                    (mapcar 'car (cl-struct-slot-info 'tramp-file-name)))))))
+                `,(tramp-compat-tramp-file-name-slots))))
     `(let* ((,(or var 'v) (tramp-dissect-file-name ,filename))
             ,@bindings)
        ;; We don't know which of those vars will be used, so we bind them all,



reply via email to

[Prev in Thread] Current Thread [Next in Thread]