]> code.delx.au - gnu-emacs/blobdiff - lisp/bookmark.el
(decipher-mode-map): Use command remapping instead of
[gnu-emacs] / lisp / bookmark.el
index 6ac3c0f9d9aa7fc789360a0dd0497058630cc786..2252087b102efc64c4c32d42ae45d6613e18bad6 100644 (file)
@@ -169,7 +169,7 @@ recently set ones come first, oldest ones come last)."
 
 
 (defcustom bookmark-automatically-show-annotations t
-  "*Nil means don't show annotations when jumping to a bookmark."
+  "*nil means don't show annotations when jumping to a bookmark."
   :type 'boolean
   :group 'bookmark)
 
@@ -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.
@@ -539,21 +539,20 @@ being set.  This might change someday.
 Optional second arg INFO-NODE means this bookmark is at info node
 INFO-NODE, so record this fact in the bookmark's entry."
   (let ((the-record
-         (` ((filename . (, (bookmark-buffer-file-name)))
-             (front-context-string
-              . (, (if (>= (- (point-max) (point)) bookmark-search-size)
-                       (buffer-substring-no-properties
-                        (point)
-                        (+ (point) bookmark-search-size))
-                     nil)))
-             (rear-context-string
-              . (, (if (>= (- (point) (point-min)) bookmark-search-size)
-                       (buffer-substring-no-properties
-                        (point)
-                        (- (point) bookmark-search-size))
-                     nil)))
-             (position . (, (point)))
-             ))))
+         `((filename . ,(bookmark-buffer-file-name))
+           (front-context-string
+            . ,(if (>= (- (point-max) (point)) bookmark-search-size)
+                   (buffer-substring-no-properties
+                    (point)
+                    (+ (point) bookmark-search-size))
+                   nil))
+           (rear-context-string
+            . ,(if (>= (- (point) (point-min)) bookmark-search-size)
+                   (buffer-substring-no-properties
+                    (point)
+                    (- (point) bookmark-search-size))
+                   nil))
+           (position . ,(point)))))
 
     ;; Now fill in the optional parts:
 
@@ -661,11 +660,11 @@ affect point."
             (ann       (nth 4 record)))
        (list
         name
-        (` ((filename             .    (, filename))
-            (front-context-string .    (, (or front-str "")))
-            (rear-context-string  .    (, (or rear-str  "")))
-            (position             .    (, position))
-            (annotation           .    (, ann)))))))
+        `((filename             .    ,filename)
+          (front-context-string .    ,(or front-str ""))
+          (rear-context-string  .    ,(or rear-str  ""))
+          (position             .    ,position)
+          (annotation           .    ,ann)))))
    old-list))
 
 
@@ -1073,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)
@@ -1347,7 +1351,7 @@ for a file, defaulting to the file defined by variable
       (set-buffer (let ((enable-local-variables nil))
                     (find-file-noselect file)))
       (goto-char (point-min))
-      (let ((print-length nil) 
+      (let ((print-length nil)
            (print-level nil))
        (delete-region (point-min) (point-max))
        (bookmark-insert-file-format-version-stamp)