bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#14435: 24.3.50; Co-operation of doc-view + desktop-save-mode, save-p


From: Tassilo Horn
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
User-agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux)

Jambunathan K <address@hidden> 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\302H\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 via email to

[Prev in Thread] Current Thread [Next in Thread]