* ffap.el (ffap-replace-file-component): Support Tramp file name
authorMichael Albinus <michael.albinus@gmx.de>
Mon, 8 Oct 2012 13:59:18 +0000 (15:59 +0200)
committerMichael Albinus <michael.albinus@gmx.de>
Mon, 8 Oct 2012 13:59:18 +0000 (15:59 +0200)
syntax, not only ange-ftp's one.

lisp/ChangeLog
lisp/ffap.el

index 97d24eb..810c76d 100644 (file)
@@ -1,3 +1,8 @@
+2012-10-08  Michael Albinus  <michael.albinus@gmx.de>
+
+       * ffap.el (ffap-replace-file-component): Support Tramp file name
+       syntax, not only ange-ftp's one.
+
 2012-10-08  Glenn Morris  <rgm@gnu.org>
 
        * cus-start.el (message-log-max): Set :version.
index f3e8d4c..4c75609 100644 (file)
@@ -482,18 +482,12 @@ Returned values:
 
 (defun ffap-replace-file-component (fullname name)
   "In remote FULLNAME, replace path with NAME.  May return nil."
-  ;; Use ange-ftp or efs if loaded, but do not load them otherwise.
-  (let (found)
-    (mapc
-     (function (lambda (sym) (and (fboundp sym) (setq found sym))))
-     '(
-       efs-replace-path-component
-       ange-ftp-replace-path-component
-       ange-ftp-replace-name-component
-       ))
-    (and found
-        (fset 'ffap-replace-file-component found)
-        (funcall found fullname name))))
+  ;; Use efs if loaded, but do not load it otherwise.
+  (if (fboundp 'efs-replace-path-component)
+      (funcall efs-replace-path-component fullname name)
+    (and (stringp fullname)
+        (stringp name)
+        (concat (file-remote-p fullname) name))))
 ;; (ffap-replace-file-component "/who@foo.com:/whatever" "/new")
 
 (defun ffap-file-suffix (file)