Subject: bug#16090: 24.3.50; [PATCH] error when jumping to a doc-view bookmark

From: Tassilo Horn <[email-masked]>
Date: Fri, 20 Dec 2013 09:00:17 +0100

Andreas Politz <[email-masked]> writes:

>       (let ((page (bookmark-prop-get bmk 'page)))
>         (when (not (eq major-mode 'doc-view-mode))
>           (doc-view-toggle-display))
> !       (run-with-idle-timer 0 nil
> !         (lambda (buffer page)
> !           (when (and (buffer-live-p buffer)
> !                      (window-live-p (get-buffer-window buffer 0)))
> !             (with-selected-window (get-buffer-window buffer 0)
> !               (doc-view-goto-page page))))
> !         (current-buffer) page))))

I just want to mention that even this timer-version acts wrongly when
the display-func of `bookmark-jump' doesn't select the window, because
`get-buffer-window' prefers the selected window.

I don't think that's too much an issue, though, because the provided
interactive bookmark functions use as display-functions only pop- and
switch-to-buffer which will select the window, and then the patch works
fine.

So I'm in favor of committing the patch [before 24.4 is released!] cause
in any case it's better than not being able to open bookmarks to
document files altogether.

The only cleaner way to get it right (I can see) was to change
bookmark.el so that it determines/creates the window to show the buffer
before calling the bookmark handler.  But that's a much larger change
possibly affecting many people that have their own bookmark-jump
functions.

Bye,
Tassilo