unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Tassilo Horn <tsdh@gnu.org>
To: Jambunathan K <kjambunathan@gmail.com>
Cc: 14435@debbugs.gnu.org
Subject: bug#14435: 24.3.50; Co-operation of doc-view + desktop-save-mode, save-place etc.
Date: Fri, 24 May 2013 13:28:41 +0200	[thread overview]
Message-ID: <878v34zkeu.fsf@thinkpad.tsdh.de> (raw)
In-Reply-To: <87txlv7dyt.fsf@gmail.com>

Jambunathan K <kjambunathan@gmail.com> writes:

> 1. Enable session management.
>
>     (custom-set-variables
>      '(desktop-base-file-name "~/.emacs.desktop")
>      '(desktop-save-mode t)
>      '(save-place t nil (saveplace))
>      '(savehist-mode t))
>
> 2. Open a PDF file.  Make sure the conversion goes through and visit
>    some arbitrary page.
>
>    The file I have is 102.3MB and has 382 pages.  
>
> 3. C-x C-c and start Emacs.
>
> 4. Note that doc-view starts with all conversion all over again.
>
> Expected behaviour: doc-view should access the already "cached" pages
> and drop me in the same page that I was in the previous session.

I've just tried this receipe (although I've done M-x desktop-save/read
explicitly instead of adding the customs as in 1), but I didn't get a
reconversion.  It used the cached images as it should.

After restoring the desktop however, I'm always on page 1 of the PDF.
I've just committed some desktop.el integration code that saves the
current page and slice as "misc" information that's later used for
restoring the desktop (revno 112712).

However, that's not really perfect.  Firstly, the page/slice information
is managed on a per-window (not per-buffer) basis, so if you have two
windows showing different pages of the same PDF, it's arbitrary whose
page/slice is saved.

The more pressing problem is that currently you'll get an error when
restoring the PDF from `desktop-read'.

--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (wrong-type-argument listp t)
  image-mode-winprops(nil)
  image-mode-window-put(page 0 nil)
  (progn (image-mode-window-put (quote page) page nil) (image-mode-window-put (quote info) (concat (propertize (format "Page %d of %d." page len) (quote face) (quote bold)) (if doc-view-current-converter-processes " (still converting...)\n" "\n") (if (and doc-view-current-search-matches (assq page doc-view-current-search-matches)) (progn (concat (propertize "Search matches:\n" (quote face) (quote bold)) (let (...) (progn ...) contexts))))) nil))
  (let ((len (doc-view-last-page-number))) (if (< page 1) (setq page 1) (if (and (> page len) (null doc-view-current-converter-processes)) (progn (setq page len)))) (progn (image-mode-window-put (quote page) page nil) (image-mode-window-put (quote info) (concat (propertize (format "Page %d of %d." page len) (quote face) (quote bold)) (if doc-view-current-converter-processes " (still converting...)\n" "\n") (if (and doc-view-current-search-matches (assq page doc-view-current-search-matches)) (progn (concat (propertize "Search matches:\n" ... ...) (let ... ... contexts))))) nil)) (let ((file (expand-file-name (format doc-view--image-file-pattern page) (doc-view-current-cache-dir)))) (doc-view-insert-image file :pointer (quote arrow)) (if (and (not (file-exists-p file)) doc-view-current-converter-processes) (progn (funcall doc-view-single-page-converter-function doc-view-buffer-file-name file page (let ((win ...)) (function (lambda nil ...))))))) (overlay-put (image-mode-window-get (quote overlay)) (quote help-echo) (image-mode-window-get (quote info))))
  doc-view-goto-page(1)
  (progn (select-window (car save-selected-window--state) (quote norecord)) (doc-view-goto-page (let ((page (assq (quote page) winprops))) (if (numberp page) page 1))))
  (unwind-protect (progn (select-window (car save-selected-window--state) (quote norecord)) (doc-view-goto-page (let ((page (assq (quote page) winprops))) (if (numberp page) page 1)))) (internal--after-with-selected-window save-selected-window--state))
  (save-current-buffer (unwind-protect (progn (select-window (car save-selected-window--state) (quote norecord)) (doc-view-goto-page (let ((page (assq ... winprops))) (if (numberp page) page 1)))) (internal--after-with-selected-window save-selected-window--state)))
  (let ((save-selected-window--state (internal--before-with-selected-window (car winprops)))) (save-current-buffer (unwind-protect (progn (select-window (car save-selected-window--state) (quote norecord)) (doc-view-goto-page (let ((page ...)) (if (numberp page) page 1)))) (internal--after-with-selected-window save-selected-window--state))))
  (if doc-view-current-converter-processes nil (let ((save-selected-window--state (internal--before-with-selected-window (car winprops)))) (save-current-buffer (unwind-protect (progn (select-window (car save-selected-window--state) (quote norecord)) (doc-view-goto-page (let (...) (if ... page 1)))) (internal--after-with-selected-window save-selected-window--state)))))
  (closure ((ol . #<overlay from 1 to 800661 in ABJKT10.pdf>) (winprops #<window 0x7280b00 on doc-view.el> (image image :type imagemagick :file "/tmp/docview1000/ABJKT10.pdf-079d2ad420811f97f127c85c9de74b5c/page-3.png" :pointer arrow :width 850) (info . #("Page 3 of 18.\n" 0 13 (face bold))) (page . 3) (slice 166 181 517 891) (overlay . #<overlay from 1 to 800661 in ABJKT10.pdf>)) t) nil (if doc-view-current-converter-processes nil (let ((save-selected-window--state (internal--before-with-selected-window (car winprops)))) (save-current-buffer (unwind-protect (progn (select-window (car save-selected-window--state) (quote norecord)) (doc-view-goto-page (let ... ...))) (internal--after-with-selected-window save-selected-window--state))))))()
  apply((closure ((ol . #<overlay from 1 to 800661 in ABJKT10.pdf>) (winprops #<window 0x7280b00 on doc-view.el> (image image :type imagemagick :file "/tmp/docview1000/ABJKT10.pdf-079d2ad420811f97f127c85c9de74b5c/page-3.png" :pointer arrow :width 850) (info . #("Page 3 of 18.\n" 0 13 (face bold))) (page . 3) (slice 166 181 517 891) (overlay . #<overlay from 1 to 800661 in ABJKT10.pdf>)) t) nil (if doc-view-current-converter-processes nil (let ((save-selected-window--state (internal--before-with-selected-window (car winprops)))) (save-current-buffer (unwind-protect (progn (select-window (car save-selected-window--state) (quote norecord)) (doc-view-goto-page (let ... ...))) (internal--after-with-selected-window save-selected-window--state)))))) nil)
  byte-code("r\301\b\302H\b\303H\"\210)\301\207" [timer apply 5 6] 4)
  timer-event-handler([t 20895 18569 782360 nil (closure ((ol . #<overlay from 1 to 800661 in ABJKT10.pdf>) (winprops #<window 0x7280b00 on doc-view.el> (image image :type imagemagick :file "/tmp/docview1000/ABJKT10.pdf-079d2ad420811f97f127c85c9de74b5c/page-3.png" :pointer arrow :width 850) (info . #("Page 3 of 18.\n" 0 13 (face bold))) (page . 3) (slice 166 181 517 891) (overlay . #<overlay from 1 to 800661 in ABJKT10.pdf>)) t) nil (if doc-view-current-converter-processes nil (let ((save-selected-window--state (internal--before-with-selected-window (car winprops)))) (save-current-buffer (unwind-protect (progn (select-window ... ...) (doc-view-goto-page ...)) (internal--after-with-selected-window save-selected-window--state)))))) nil nil 35000])
--8<---------------cut here---------------end--------------->8---

The error comes from the closure run from a timer in
`doc-view-new-window-function'.  The document is shown with the correct
page and slice anyway.  Argh, that image-mode winprops stuff is a beast.

Stefan, since you've said the functions run by timers in
`doc-view-new-window-function' shouldn't be needed anyway and probably
work around a bug elsewhere, could you please have a look?

Bye,
Tassilo





  reply	other threads:[~2013-05-24 11:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-22  5:58 bug#14435: 24.3.50; Co-operation of doc-view + desktop-save-mode, save-place etc Jambunathan K
2013-05-24 11:28 ` Tassilo Horn [this message]
2013-05-24 13:35   ` Jambunathan K
2013-05-24 17:44   ` Stefan Monnier
2013-05-24 22:23     ` Tassilo Horn
2013-05-25  1:55       ` Stefan Monnier
2013-05-26 18:48         ` Tassilo Horn
2013-05-27  0:59           ` Stefan Monnier
2013-05-27  7:46             ` Tassilo Horn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878v34zkeu.fsf@thinkpad.tsdh.de \
    --to=tsdh@gnu.org \
    --cc=14435@debbugs.gnu.org \
    --cc=kjambunathan@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).