summaryrefslogtreecommitdiff
path: root/lisp/bookmark.el
diff options
context:
space:
mode:
authorGerd Moellmann <gerd@gnu.org>2000-03-06 12:46:50 +0000
committerGerd Moellmann <gerd@gnu.org>2000-03-06 12:46:50 +0000
commit8d56596c3ca816085efdfe7584df69e2e60af6de (patch)
treeff9ceb90c0ef5938969fd06d0aac30be38357ed8 /lisp/bookmark.el
parent4dd8a783b3058fbba531054ee63299b7488a1d72 (diff)
downloademacs-8d56596c3ca816085efdfe7584df69e2e60af6de.tar.gz
(bookmark-file-or-variation-thereof): New func, for
code abstracted out of `bookmark-jump-noselect'. Now tries info extensions as well as compression extensions. (bookmark-jump-noselect): Use above new func.
Diffstat (limited to 'lisp/bookmark.el')
-rw-r--r--lisp/bookmark.el34
1 files changed, 17 insertions, 17 deletions
diff --git a/lisp/bookmark.el b/lisp/bookmark.el
index 476a66d8c97..b6e084d6898 100644
--- a/lisp/bookmark.el
+++ b/lisp/bookmark.el
@@ -1077,6 +1077,22 @@ of the old one in the permanent bookmark record."
(bookmark-show-annotation bookmark)))))
+(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)))
+
+
(defun bookmark-jump-noselect (str)
;; a leetle helper for bookmark-jump :-)
;; returns (BUFFER . POINT)
@@ -1088,23 +1104,7 @@ of the old one in the permanent bookmark record."
(info-node (bookmark-get-info-node str))
(orig-file file)
)
- (if (or
- (file-exists-p file)
- ;; Else try some common compression extensions, which Emacs
- ;; usually handles right. I hope.
- (setq file
- (or
- (let ((altname (concat file ".Z")))
- (and (file-exists-p altname)
- altname))
- (let ((altname (concat file ".gz")))
- (and (file-exists-p altname)
- altname))
- (let ((altname (concat file ".z")))
- (and (file-exists-p altname)
- altname))
- ;; Check VC incarnations, preparatory to checkout
- (if (vc-backend file) file nil))))
+ (if (setq file (bookmark-file-or-variation-thereof file))
(save-excursion
(save-window-excursion
(if info-node