From 3ccd4eafd3d51285b2d9eb4e5e83b3be20dbfe9f Mon Sep 17 00:00:00 2001 From: Tassilo Horn Date: Fri, 4 Apr 2014 19:42:55 +0200 Subject: [PATCH] Fix bug#16090. * lisp/doc-view.el (doc-view-bookmark-jump): Use `bookmark-after-jump-hook' to jump to the right page after the buffer is shown in a window. --- lisp/ChangeLog | 6 ++++++ lisp/doc-view.el | 23 +++++++++++++---------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a49b0e7dc7c..7ab920990b4 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2014-04-04 Tassilo Horn + + * doc-view.el (doc-view-bookmark-jump): Use + `bookmark-after-jump-hook' to jump to the right page after the + buffer is shown in a window. (bug#16090) + 2014-04-04 Eli Zaretskii * international/characters.el (mirroring): Fix last change: diff --git a/lisp/doc-view.el b/lisp/doc-view.el index 6706865e598..09d5925b3e2 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -1862,20 +1862,23 @@ See the command `doc-view-mode' for more information on this mode." `((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. - (prog1 (bookmark-default-handler bmk) - (let ((page (bookmark-prop-get bmk 'page))) - (when (not (eq major-mode 'doc-view-mode)) - (doc-view-toggle-display)) - (with-selected-window - (or (get-buffer-window (current-buffer) 0) - (selected-window)) - (doc-view-goto-page page))))) - + (let ((page (bookmark-prop-get bmk 'page)) + (show-fn-sym (make-symbol "doc-view-bookmark-after-jump-hook"))) + (fset show-fn-sym + (lambda () + (remove-hook 'bookmark-after-jump-hook show-fn-sym) + (when (not (eq major-mode 'doc-view-mode)) + (doc-view-toggle-display)) + (with-selected-window + (or (get-buffer-window (current-buffer) 0) + (selected-window)) + (doc-view-goto-page page)))) + (add-hook 'bookmark-after-jump-hook show-fn-sym) + (bookmark-default-handler bmk))) (provide 'doc-view) -- 2.39.2