]> code.delx.au - gnu-emacs/blobdiff - lisp/bookmark.el
(decipher-mode-map): Use command remapping instead of
[gnu-emacs] / lisp / bookmark.el
index 53939f92ca6950421e4d829eb486d1a6eba8d260..2252087b102efc64c4c32d42ae45d6613e18bad6 100644 (file)
@@ -194,7 +194,7 @@ following in your `.emacs' file:
 (defcustom bookmark-menu-length 70
   "*Maximum length of a bookmark name displayed on a popup menu."
   :type 'integer
-  :group 'boolean)
+  :group 'bookmark)
 
 
 ;;; No user-serviceable parts beyond this point.
@@ -1072,19 +1072,24 @@ 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 (a string) if it exists, or return a reasonable
+variation of FILE if that exists.  Reasonable variations are checked
+by appending suffixes defined in `Info-suffix-list'.  If cannot find FILE
+nor a reasonable variation thereof, then still return FILE if it can
+be retrieved from a VC backend, else return nil."
+  (if (file-exists-p file)
+      file
+    (or
+     (progn (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))
+     ;; Last possibility: try VC
+     (if (vc-backend file) file))))
 
 
 (defun bookmark-jump-noselect (str)