summaryrefslogtreecommitdiff
path: root/lisp/ffap.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2022-01-14 10:29:43 +0100
committerLars Ingebrigtsen <larsi@gnus.org>2022-01-14 10:51:15 +0100
commitf729c333c7ae6d159e4af510b21e0fd031786bd1 (patch)
tree9a6d9641e3c64eccbe0f4313f80ae8f44bba28fb /lisp/ffap.el
parent19566fb51a3c60e90df723018986ccc3d5b5086b (diff)
downloademacs-f729c333c7ae6d159e4af510b21e0fd031786bd1.tar.gz
Don't have ffap interpret ":/bin" as the current directory
* lisp/ffap.el (ffap-file-at-point): Don't interpret :/bin as the current directory (bug#52441).
Diffstat (limited to 'lisp/ffap.el')
-rw-r--r--lisp/ffap.el11
1 files changed, 7 insertions, 4 deletions
diff --git a/lisp/ffap.el b/lisp/ffap.el
index f9220817a71..b5d2a02cd1d 100644
--- a/lisp/ffap.el
+++ b/lisp/ffap.el
@@ -1449,10 +1449,13 @@ which may actually result in an URL rather than a filename."
(ffap-file-exists-string (substring name 0 (match-beginning 0)))))
;; If it contains a colon, get rid of it (and return if exists)
((and (string-match path-separator name)
- (setq name (ffap-string-at-point 'nocolon))
- (> (length name) 0)
- (ffap-file-exists-string name)))
- ;; File does not exist, try the alist:
+ (let ((this-name (ffap-string-at-point 'nocolon)))
+ ;; But don't interpret the first part if ":/bin" as
+ ;; the empty string.
+ (when (> (length this-name) 0)
+ (setq name this-name)
+ (ffap-file-exists-string name)))))
+ ;; File does not exist, try the alist:
((let ((alist ffap-alist) tem try case-fold-search)
(while (and alist (not try))
(setq tem (car alist) alist (cdr alist))