summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorKarl Fogel <kfogel@red-bean.com>2002-06-08 03:33:09 +0000
committerKarl Fogel <kfogel@red-bean.com>2002-06-08 03:33:09 +0000
commitdd33e6e94bb011a3e6e9be7b00aedc89679f01ee (patch)
treebdbc5f43a2bb8fcfa9bd6dd46adb8e470abc7712 /lisp
parent1b65481e291ba1a8b9a21d688b8255459442c5f5 (diff)
downloademacs-dd33e6e94bb011a3e6e9be7b00aedc89679f01ee.tar.gz
* bookmark.el (bookmark-file-or-variation-thereof): Just use
Info-suffix-list, as suggested by Stefan Monnier.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/bookmark.el25
2 files changed, 17 insertions, 13 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index da57c509295..68fdbec84bd 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2002-06-07 Karl Fogel <kfogel@red-bean.com>
+
+ * bookmark.el (bookmark-file-or-variation-thereof): Just use
+ Info-suffix-list, as suggested by Stefan Monnier.
+
2002-06-05 Eli Zaretskii <eliz@is.elta.co.il>
* select.el (xselect-convert-to-string): If VALUE is a string,
diff --git a/lisp/bookmark.el b/lisp/bookmark.el
index 53939f92ca6..c3bab39ba3d 100644
--- a/lisp/bookmark.el
+++ b/lisp/bookmark.el
@@ -1072,19 +1072,18 @@ of the old one in the permanent bookmark record."
(defun bookmark-file-or-variation-thereof (file)
- "Return FILE (a string) if it exists in any reasonable variation, else nil.
-Reasonable variations are FILE.gz, FILE.Z, FILE.info, FILE.info.gz, etc."
- (cond
- ((file-exists-p file) file)
- ((file-exists-p (concat file ".Z")) (concat file ".Z"))
- ((file-exists-p (concat file ".gz")) (concat file ".gz"))
- ((file-exists-p (concat file ".z")) (concat file ".z"))
- ((file-exists-p (concat file ".info")) (concat file ".info"))
- ((file-exists-p (concat file ".info.gz")) (concat file ".info.gz"))
- ((file-exists-p (concat file ".info.Z")) (concat file ".info.Z"))
- ((file-exists-p (concat file ".info.z")) (concat file ".info.z"))
- ((vc-backend file) file) ; maybe VC has it?
- (t nil)))
+ "Return FILE if it exists, or return the first variation based on
+`Info-suffix-list' that exists, else return nil."
+ (if (file-exists-p file)
+ file
+ (require 'info) ; ensure Info-suffix-list is bound
+ (catch 'found
+ (mapc (lambda (elt)
+ (let ((suffixed-file (concat file (car elt))))
+ (if (file-exists-p suffixed-file)
+ (throw 'found suffixed-file))))
+ Info-suffix-list)
+ nil)))
(defun bookmark-jump-noselect (str)