changeset 45793:4bcea799d0bd

* bookmark.el (bookmark-file-or-variation-thereof): Restore vc-backend check, thanks to Robert Thorpe <robert.thorpe@antenova.com> for noticing. Redocument.
author Karl Fogel <kfogel@red-bean.com>
date Wed, 12 Jun 2002 21:44:33 +0000
parents 06dfe6599590
children 552d3de9e9ed
files lisp/ChangeLog lisp/bookmark.el
diffstat 2 files changed, 22 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Wed Jun 12 20:55:27 2002 +0000
+++ b/lisp/ChangeLog	Wed Jun 12 21:44:33 2002 +0000
@@ -1,3 +1,8 @@
+2002-06-12  Karl Fogel  <kfogel@red-bean.com>
+
+	* bookmark.el (bookmark-file-or-variation-thereof): Restore
+	vc-backend check, thanks to Robert Thorpe for noticing.
+
 2002-06-12  Eli Zaretskii  <eliz@is.elta.co.il>
 
 	* textmodes/bibtex.el: Change the maintainer to "none".
--- a/lisp/bookmark.el	Wed Jun 12 20:55:27 2002 +0000
+++ b/lisp/bookmark.el	Wed Jun 12 21:44:33 2002 +0000
@@ -1072,19 +1072,25 @@
 
 
 (defun bookmark-file-or-variation-thereof (file)
-  "Return FILE (a string) or a reasonable variation that exists, else nil.
-Reasonable variations of the name are made by appending suffixes defined
-in `Info-suffix-list'."
+  "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
-    (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)))
+    (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)
   ;; a leetle helper for bookmark-jump :-)