(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.
This commit is contained in:
Stefan Monnier 2008-03-09 21:37:16 +00:00
parent 136894c8fc
commit a9f8b49b44
2 changed files with 16 additions and 9 deletions

View file

@ -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.

View file

@ -1082,26 +1082,28 @@ See the command `doc-view-mode' for more information on this mode."
;;;; 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)))))