summaryrefslogtreecommitdiff
path: root/lisp/ffap.el
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2012-10-08 15:59:18 +0200
committerMichael Albinus <michael.albinus@gmx.de>2012-10-08 15:59:18 +0200
commit775a132d58804935a757d958aecaf53b44d9a78a (patch)
treea50d1e61f3959dd51d1d4441f96ba9c09ae6ea03 /lisp/ffap.el
parent607446ba2c440487bcc4ac493beaa65df7415914 (diff)
downloademacs-775a132d58804935a757d958aecaf53b44d9a78a.tar.gz
* ffap.el (ffap-replace-file-component): Support Tramp file name
syntax, not only ange-ftp's one.
Diffstat (limited to 'lisp/ffap.el')
-rw-r--r--lisp/ffap.el18
1 files changed, 6 insertions, 12 deletions
diff --git a/lisp/ffap.el b/lisp/ffap.el
index f3e8d4c194e..4c75609fe01 100644
--- a/lisp/ffap.el
+++ b/lisp/ffap.el
@@ -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)