changeset 92691:0574109ed8bc

(bookmark-buffer-file-name, bookmark-prop-get): Declare. (doc-view-bookmark-make-record): Use them. (doc-view-bookmark-jump): Use them. Fix find-file -> find-file-noselect. (bookmark-get-filename, bookmark-get-bookmark-record): Remove.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sun, 09 Mar 2008 21:37:16 +0000
parents ae00481eacc1
children d999f30304bc
files lisp/ChangeLog lisp/doc-view.el
diffstat 2 files changed, 16 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sun Mar 09 21:35:01 2008 +0000
+++ b/lisp/ChangeLog	Sun Mar 09 21:37:16 2008 +0000
@@ -1,5 +1,10 @@
 2008-03-09  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+	* doc-view.el (bookmark-buffer-file-name, bookmark-prop-get): Declare.
+	(doc-view-bookmark-make-record): Use them.
+	(doc-view-bookmark-jump): Use them.  Fix find-file -> find-file-noselect.
+	(bookmark-get-filename, bookmark-get-bookmark-record): Remove.
+
 	* bookmark.el (bookmark-make-record-function): Change expected return value
 	to include a suggested bookmark name.
 	(bookmark-make): Split into bookmark-make-record and bookmark-store.
--- a/lisp/doc-view.el	Sun Mar 09 21:35:01 2008 +0000
+++ b/lisp/doc-view.el	Sun Mar 09 21:37:16 2008 +0000
@@ -1082,26 +1082,28 @@
 
 ;;;; Bookmark integration
 
+(declare-function bookmark-buffer-file-name "bookmark" ())
+(declare-function bookmark-prop-get "bookmark" (bookmark prop))
+
 (defun doc-view-bookmark-make-record ()
-  `((filename . ,buffer-file-name)
+  `((filename . ,(bookmark-buffer-file-name))
     (page     . ,(doc-view-current-page))
     (handler  . doc-view-bookmark-jump)))
 
 
-(declare-function bookmark-get-filename        "bookmark" (bookmark))
-(declare-function bookmark-get-bookmark-record "bookmark" (bookmark))
-
 ;;;###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.
-  (save-window-excursion
-    (let ((filename (bookmark-get-filename bmk))
-	  (page (cdr (assq 'page (bookmark-get-bookmark-record bmk)))))
-      (find-file filename)
+  (let ((filename (bookmark-prop-get bmk 'filename))
+        (page (bookmark-prop-get bmk 'page)))
+    (with-current-buffer (find-file-noselect filename)
       (when (not (eq major-mode 'doc-view-mode))
 	(doc-view-toggle-display))
-      (doc-view-goto-page page)
+      (with-selected-window
+          (or (get-buffer-window (current-buffer) 0)
+              (selected-window))
+        (doc-view-goto-page page))
       `((buffer ,(current-buffer)) (position ,1)))))