diff lisp/doc-view.el @ 96280:bfca3297fa0b

* bookmark.el (bookmark-alist): Allow the 2 slightly different formats used until now in bookmark.el's code. (bookmark-get-bookmark): Accept bookmark names or bookmark records. (bookmark-get-bookmark-record): Allow the 2 slightly different formats used until now in bookmark.el's code. (bookmark-set-filename): Remove special code, moved to its only caller. (bookmark-store): Use the newer format. (bookmark-make-record-default): Add arg `point-only'. Rename from bookmark-make-record-for-text-file. (bookmark--jump-via): New function. (bookmark-jump, bookmark-jump-other-window, bookmark-bmenu-2-window) (bookmark-bmenu-other-window, bookmark-bmenu-switch-other-window): Use it. (bookmark-jump-noselect, bookmark-default-handler): Don't return an alist, instead return the data implicitly by changing current buffer and point. Signal an error if the file doesn't exist. * info.el (Info-bookmark-make-record): Use bookmark-make-record-default. (Info-bookmark-jump): Use bookmark-default-handler. * image-mode.el (image-bookmark-make-record): Use bookmark-make-record-default. (image-bookmark-jump): Use bookmark-default-handler. * doc-view.el (doc-view-bookmark-make-record): Use bookmark-make-record-default. (doc-view-bookmark-jump): Use bookmark-default-handler.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Wed, 25 Jun 2008 16:51:33 +0000
parents b4e36ff621b3
children 9f0e98dc97b7
line wrap: on
line diff
--- a/lisp/doc-view.el	Wed Jun 25 15:46:23 2008 +0000
+++ b/lisp/doc-view.el	Wed Jun 25 16:51:33 2008 +0000
@@ -1187,29 +1187,28 @@
 
 ;;;; Bookmark integration
 
-(declare-function bookmark-buffer-file-name "bookmark" ())
+(declare-function bookmark-make-record-default "bookmark" ())
 (declare-function bookmark-prop-get "bookmark" (bookmark prop))
+(declare-function bookmark-default-handler "bookmark" (bmk))
 
 (defun doc-view-bookmark-make-record ()
-  `((filename . ,(bookmark-buffer-file-name))
-    (page     . ,(doc-view-current-page))
-    (handler  . doc-view-bookmark-jump)))
+  (nconc (bookmark-make-record-default)
+         `((page     . ,(doc-view-current-page))
+           (handler  . doc-view-bookmark-jump))))
 
 
 ;;;###autoload
 (defun doc-view-bookmark-jump (bmk)
   ;; This implements the `handler' function interface for record type
   ;; returned by `doc-view-bookmark-make-record', which see.
-  (let ((filename (bookmark-prop-get bmk 'filename))
-        (page (bookmark-prop-get bmk 'page)))
-    (with-current-buffer (find-file-noselect filename)
+  (prog1 (bookmark-default-handler bmk)
+    (let ((page (bookmark-prop-get bmk 'page)))
       (when (not (eq major-mode 'doc-view-mode))
-	(doc-view-toggle-display))
+        (doc-view-toggle-display))
       (with-selected-window
           (or (get-buffer-window (current-buffer) 0)
               (selected-window))
-        (doc-view-goto-page page))
-      `((buffer ,(current-buffer)) (position ,1)))))
+        (doc-view-goto-page page)))))
 
 
 (provide 'doc-view)