- "Call BOOKMARK's handler or `bookmark-default-handler' if it has none."
- (let ((found (funcall (or (bookmark-get-handler bookmark)
- 'bookmark-default-handler)
- bookmark)))
- (unless found
- ;; Else unable to find the marked file, so ask if user wants to
- ;; relocate the bookmark, else remind them to consider deletion.
- (let ((file (bookmark-get-filename bookmark)))
- (when file ;Don't know how to relocate if there's no `file'.
- (setq file (expand-file-name file))
- (ding)
- (if (y-or-n-p (concat (file-name-nondirectory file)
- " nonexistent. Relocate \""
- bookmark
- "\"? "))
- (progn
- (bookmark-relocate bookmark)
- ;; Try again.
- (setq found (funcall (or (bookmark-get-handler bookmark)
- 'bookmark-default-handler)
- bookmark)))
- (message
- "Bookmark not relocated; consider removing it \(%s\)." bookmark)))))
- (when found
- ;; Added by db.
- (setq bookmark-current-bookmark bookmark)
- found)))
-
-(defun bookmark-default-handler (str)
- ;; Helper for bookmark-jump. STR is a bookmark name, of the sort
- ;; accepted by `bookmark-get-bookmark'.
- ;;
- ;; Return an alist '((buffer BUFFER) (position POSITION) ...)
- ;; indicating the bookmarked point within the specied buffer. Any
- ;; elements not documented here should be ignored.
- (bookmark-maybe-load-default-file)
- (let* ((file (expand-file-name (bookmark-get-filename str)))
- (forward-str (bookmark-get-front-context-string str))
- (behind-str (bookmark-get-rear-context-string str))
- (place (bookmark-get-position str)))
+ "Return the location pointed to by the bookmark BOOKMARK.
+The return value has the form (BUFFER . POINT).
+
+Note: this function is deprecated and is present for Emacs 22
+compatibility only."
+ (save-excursion
+ (bookmark-handle-bookmark bookmark)
+ (cons (current-buffer) (point))))
+
+(make-obsolete 'bookmark-jump-noselect 'bookmark-handle-bookmark "23.1")
+
+(defun bookmark-handle-bookmark (bookmark)
+ "Call BOOKMARK's handler or `bookmark-default-handler' if it has none.
+Changes current buffer and point and returns nil, or signals a `file-error'.
+BOOKMARK can be a bookmark record used internally by some other
+elisp package, or the name of a bookmark to be found in `bookmark-alist'."
+ (condition-case err
+ (funcall (or (bookmark-get-handler bookmark)
+ 'bookmark-default-handler)
+ (bookmark-get-bookmark bookmark))
+ (file-error
+ ;; We were unable to find the marked file, so ask if user wants to
+ ;; relocate the bookmark, else remind them to consider deletion.
+ (when (stringp bookmark)
+ ;; `bookmark' can either be a bookmark name (found in
+ ;; `bookmark-alist') or a bookmark object. If it's an object, we
+ ;; assume it's a bookmark used internally by some other package.
+ (let ((file (bookmark-get-filename bookmark)))
+ (when file ;Don't know how to relocate if there's no `file'.
+ (setq file (expand-file-name file))
+ (ding)
+ (if (y-or-n-p (concat (file-name-nondirectory file)
+ " nonexistent. Relocate \""
+ bookmark
+ "\"? "))
+ (progn
+ (bookmark-relocate bookmark)
+ ;; Try again.
+ (funcall (or (bookmark-get-handler bookmark)
+ 'bookmark-default-handler)
+ (bookmark-get-bookmark bookmark)))
+ (message
+ "Bookmark not relocated; consider removing it \(%s\)." bookmark)
+ (signal (car err) (cdr err))))))))
+ ;; Added by db.
+ (when (stringp bookmark)
+ (setq bookmark-current-bookmark bookmark))
+ nil)
+
+(defun bookmark-default-handler (bmk)
+ "Default handler to jump to a particular bookmark location.
+BMK is a bookmark record.
+Changes current buffer and point and returns nil, or signals a `file-error'."
+ (let* ((file (bookmark-get-filename bmk))
+ (buf (bookmark-prop-get bmk 'buffer))
+ (forward-str (bookmark-get-front-context-string bmk))
+ (behind-str (bookmark-get-rear-context-string bmk))
+ (place (bookmark-get-position bmk)))