mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-02-07 20:54:32 +00:00
* 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
This commit is contained in:
parent
a4f59c0fb9
commit
5010583555
@ -1,10 +1,18 @@
|
||||
2013-05-24 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||
|
||||
* image-mode.el (image-mode-winprops): Add winprops to
|
||||
image-mode-winprops-alist before running
|
||||
image-mode-new-window-functions.
|
||||
* doc-view.el (doc-view-new-window-function): Don't delay
|
||||
doc-view-goto-page via timers (bug#14435).
|
||||
|
||||
2013-05-24 Tassilo Horn <tsdh@gnu.org>
|
||||
|
||||
* doc-view.el: Integrate with desktop.el. (Bug#14435)
|
||||
(doc-view-desktop-save-buffer): New function.
|
||||
(doc-view-restore-desktop-buffer): New function.
|
||||
(desktop-buffer-mode-handlers): Add
|
||||
`doc-view-restore-desktop-buffer' as desktop.el buffer mode
|
||||
(desktop-buffer-mode-handlers):
|
||||
Add `doc-view-restore-desktop-buffer' as desktop.el buffer mode
|
||||
handler.
|
||||
(doc-view-mode): Set `doc-view-desktop-save-buffer' as custom
|
||||
`desktop-save-buffer' function.
|
||||
|
@ -328,24 +328,15 @@ of the page moves to the previous page."
|
||||
(cl-assert (eq t (car winprops)))
|
||||
(delete-overlay ol))
|
||||
(image-mode-window-put 'overlay ol winprops)
|
||||
(when (windowp (car winprops))
|
||||
(if (stringp (overlay-get ol 'display))
|
||||
;; We're not already displaying an image, so this is the
|
||||
;; initial window showing the document.
|
||||
(run-with-timer nil nil
|
||||
(lambda ()
|
||||
;; In case a conversion is running, the
|
||||
;; refresh will happen as defined by
|
||||
;; `doc-view-conversion-refresh-interval'.
|
||||
(unless doc-view-current-converter-processes
|
||||
(with-selected-window (car winprops)
|
||||
(doc-view-goto-page 1)))))
|
||||
;; We've split the window showing the document. All we need
|
||||
;; to do is selecting the new window to cause a redisplay to
|
||||
;; make the image appear there, too.
|
||||
(run-with-timer nil nil
|
||||
(lambda ()
|
||||
(with-selected-window (car winprops))))))))
|
||||
(when (and (windowp (car winprops))
|
||||
(stringp (overlay-get ol 'display))
|
||||
(null doc-view-current-converter-processes))
|
||||
;; We're not displaying an image yet, so let's do so. This happens when
|
||||
;; the buffer is displayed for the first time.
|
||||
;; Don't do it if there's a conversion is running, since in that case, it
|
||||
;; will be done later.
|
||||
(with-selected-window (car winprops)
|
||||
(doc-view-goto-page 1)))))
|
||||
|
||||
(defvar doc-view-current-files nil
|
||||
"Only used internally.")
|
||||
@ -1651,14 +1642,17 @@ If BACKWARD is non-nil, jump to the previous match."
|
||||
|
||||
;; desktop.el integration
|
||||
|
||||
(defun doc-view-desktop-save-buffer (desktop-dirname)
|
||||
(defun doc-view-desktop-save-buffer (_desktop-dirname)
|
||||
`((page . ,(doc-view-current-page))
|
||||
(slice . ,(doc-view-current-slice))))
|
||||
|
||||
(declare-function desktop-restore-file-buffer "desktop"
|
||||
(buffer-filename buffer-name buffer-misc))
|
||||
|
||||
(defun doc-view-restore-desktop-buffer (file name misc)
|
||||
(let ((page (cdr (assq 'page misc)))
|
||||
(slice (cdr (assq 'slice misc))))
|
||||
(prog1 (desktop-restore-file-buffer file name misc))
|
||||
(desktop-restore-file-buffer file name misc)
|
||||
(with-selected-window (or (get-buffer-window (current-buffer) 0)
|
||||
(selected-window))
|
||||
(doc-view-goto-page page)
|
||||
|
@ -69,13 +69,17 @@ otherwise it defaults to t, used for times when the buffer is not displayed."
|
||||
image-mode-winprops-alist))))
|
||||
(let ((winprops (assq window image-mode-winprops-alist)))
|
||||
;; For new windows, set defaults from the latest.
|
||||
(unless winprops
|
||||
(if winprops
|
||||
;; Move window to front.
|
||||
(setq image-mode-winprops-alist
|
||||
(cons winprops (delq winprops image-mode-winprops-alist)))
|
||||
(setq winprops (cons window
|
||||
(copy-alist (cdar image-mode-winprops-alist))))
|
||||
;; Add winprops before running the hook, to avoid inf-loops if the hook
|
||||
;; triggers window-configuration-change-hook.
|
||||
(setq image-mode-winprops-alist
|
||||
(cons winprops image-mode-winprops-alist))
|
||||
(run-hook-with-args 'image-mode-new-window-functions winprops))
|
||||
;; Move window to front.
|
||||
(setq image-mode-winprops-alist
|
||||
(cons winprops (delq winprops image-mode-winprops-alist)))
|
||||
winprops))
|
||||
|
||||
(defun image-mode-window-get (prop &optional winprops)
|
||||
|
Loading…
x
Reference in New Issue
Block a user