aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2013-05-24 13:42:23 -0400
committerStefan Monnier2013-05-24 13:42:23 -0400
commit5010583555fce883d83e7a50e26d9d34f9e108ce (patch)
tree4de9abcb55be0e5bc8bb4f1860ffc0ed331636fa
parenta4f59c0fb9e684f06ab82236474fbf4586968dad (diff)
downloademacs-5010583555fce883d83e7a50e26d9d34f9e108ce.tar.gz
emacs-5010583555fce883d83e7a50e26d9d34f9e108ce.zip
* lisp/image-mode.el (image-mode-winprops): Add winprops to
image-mode-winprops-alist before running image-mode-new-window-functions. * lisp/doc-view.el (doc-view-new-window-function): Don't delay doc-view-goto-page via timers. Fixes: debbugs:14435
-rw-r--r--lisp/ChangeLog12
-rw-r--r--lisp/doc-view.el34
-rw-r--r--lisp/image-mode.el12
3 files changed, 32 insertions, 26 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 17d17698936..8dd3ef277b0 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,10 +1,18 @@
12013-05-24 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * image-mode.el (image-mode-winprops): Add winprops to
4 image-mode-winprops-alist before running
5 image-mode-new-window-functions.
6 * doc-view.el (doc-view-new-window-function): Don't delay
7 doc-view-goto-page via timers (bug#14435).
8
12013-05-24 Tassilo Horn <tsdh@gnu.org> 92013-05-24 Tassilo Horn <tsdh@gnu.org>
2 10
3 * doc-view.el: Integrate with desktop.el. (Bug#14435) 11 * doc-view.el: Integrate with desktop.el. (Bug#14435)
4 (doc-view-desktop-save-buffer): New function. 12 (doc-view-desktop-save-buffer): New function.
5 (doc-view-restore-desktop-buffer): New function. 13 (doc-view-restore-desktop-buffer): New function.
6 (desktop-buffer-mode-handlers): Add 14 (desktop-buffer-mode-handlers):
7 `doc-view-restore-desktop-buffer' as desktop.el buffer mode 15 Add `doc-view-restore-desktop-buffer' as desktop.el buffer mode
8 handler. 16 handler.
9 (doc-view-mode): Set `doc-view-desktop-save-buffer' as custom 17 (doc-view-mode): Set `doc-view-desktop-save-buffer' as custom
10 `desktop-save-buffer' function. 18 `desktop-save-buffer' function.
diff --git a/lisp/doc-view.el b/lisp/doc-view.el
index d7476114fcb..3a4a8138237 100644
--- a/lisp/doc-view.el
+++ b/lisp/doc-view.el
@@ -328,24 +328,15 @@ of the page moves to the previous page."
328 (cl-assert (eq t (car winprops))) 328 (cl-assert (eq t (car winprops)))
329 (delete-overlay ol)) 329 (delete-overlay ol))
330 (image-mode-window-put 'overlay ol winprops) 330 (image-mode-window-put 'overlay ol winprops)
331 (when (windowp (car winprops)) 331 (when (and (windowp (car winprops))
332 (if (stringp (overlay-get ol 'display)) 332 (stringp (overlay-get ol 'display))
333 ;; We're not already displaying an image, so this is the 333 (null doc-view-current-converter-processes))
334 ;; initial window showing the document. 334 ;; We're not displaying an image yet, so let's do so. This happens when
335 (run-with-timer nil nil 335 ;; the buffer is displayed for the first time.
336 (lambda () 336 ;; Don't do it if there's a conversion is running, since in that case, it
337 ;; In case a conversion is running, the 337 ;; will be done later.
338 ;; refresh will happen as defined by 338 (with-selected-window (car winprops)
339 ;; `doc-view-conversion-refresh-interval'. 339 (doc-view-goto-page 1)))))
340 (unless doc-view-current-converter-processes
341 (with-selected-window (car winprops)
342 (doc-view-goto-page 1)))))
343 ;; We've split the window showing the document. All we need
344 ;; to do is selecting the new window to cause a redisplay to
345 ;; make the image appear there, too.
346 (run-with-timer nil nil
347 (lambda ()
348 (with-selected-window (car winprops))))))))
349 340
350(defvar doc-view-current-files nil 341(defvar doc-view-current-files nil
351 "Only used internally.") 342 "Only used internally.")
@@ -1651,14 +1642,17 @@ If BACKWARD is non-nil, jump to the previous match."
1651 1642
1652;; desktop.el integration 1643;; desktop.el integration
1653 1644
1654(defun doc-view-desktop-save-buffer (desktop-dirname) 1645(defun doc-view-desktop-save-buffer (_desktop-dirname)
1655 `((page . ,(doc-view-current-page)) 1646 `((page . ,(doc-view-current-page))
1656 (slice . ,(doc-view-current-slice)))) 1647 (slice . ,(doc-view-current-slice))))
1657 1648
1649(declare-function desktop-restore-file-buffer "desktop"
1650 (buffer-filename buffer-name buffer-misc))
1651
1658(defun doc-view-restore-desktop-buffer (file name misc) 1652(defun doc-view-restore-desktop-buffer (file name misc)
1659 (let ((page (cdr (assq 'page misc))) 1653 (let ((page (cdr (assq 'page misc)))
1660 (slice (cdr (assq 'slice misc)))) 1654 (slice (cdr (assq 'slice misc))))
1661 (prog1 (desktop-restore-file-buffer file name misc)) 1655 (desktop-restore-file-buffer file name misc)
1662 (with-selected-window (or (get-buffer-window (current-buffer) 0) 1656 (with-selected-window (or (get-buffer-window (current-buffer) 0)
1663 (selected-window)) 1657 (selected-window))
1664 (doc-view-goto-page page) 1658 (doc-view-goto-page page)
diff --git a/lisp/image-mode.el b/lisp/image-mode.el
index ac090f020b3..909e2fa247f 100644
--- a/lisp/image-mode.el
+++ b/lisp/image-mode.el
@@ -69,13 +69,17 @@ otherwise it defaults to t, used for times when the buffer is not displayed."
69 image-mode-winprops-alist)))) 69 image-mode-winprops-alist))))
70 (let ((winprops (assq window image-mode-winprops-alist))) 70 (let ((winprops (assq window image-mode-winprops-alist)))
71 ;; For new windows, set defaults from the latest. 71 ;; For new windows, set defaults from the latest.
72 (unless winprops 72 (if winprops
73 ;; Move window to front.
74 (setq image-mode-winprops-alist
75 (cons winprops (delq winprops image-mode-winprops-alist)))
73 (setq winprops (cons window 76 (setq winprops (cons window
74 (copy-alist (cdar image-mode-winprops-alist)))) 77 (copy-alist (cdar image-mode-winprops-alist))))
78 ;; Add winprops before running the hook, to avoid inf-loops if the hook
79 ;; triggers window-configuration-change-hook.
80 (setq image-mode-winprops-alist
81 (cons winprops image-mode-winprops-alist))
75 (run-hook-with-args 'image-mode-new-window-functions winprops)) 82 (run-hook-with-args 'image-mode-new-window-functions winprops))
76 ;; Move window to front.
77 (setq image-mode-winprops-alist
78 (cons winprops (delq winprops image-mode-winprops-alist)))
79 winprops)) 83 winprops))
80 84
81(defun image-mode-window-get (prop &optional winprops) 85(defun image-mode-window-get (prop &optional winprops)