]> git.eshelyaron.com Git - emacs.git/commitdiff
Correct display of Doc View documents after tab switching
authorPo Lu <luangruo@yahoo.com>
Mon, 29 Jul 2024 01:19:48 +0000 (09:19 +0800)
committerEshel Yaron <me@eshelyaron.com>
Mon, 29 Jul 2024 18:12:05 +0000 (20:12 +0200)
* lisp/doc-view.el (doc-view-new-window-function): Prevent
creation of duplicate overlays for the same window after a
window configuration change occasions a call to i-m-r-winprops.

(cherry picked from commit a475360af980673fe97a701633375c3a308364c6)

lisp/doc-view.el

index ce505b1996909efe1a456b30b2f24b99872c0c45..2921af355903731d2ad261bc4baf03c7176bcc2f 100644 (file)
@@ -432,6 +432,15 @@ of the page moves to the previous page."
 
 (defun doc-view-new-window-function (winprops)
   ;; (message "New window %s for buf %s" (car winprops) (current-buffer))
+  ;;
+  ;; If the window configuration changed, `image-mode-reapply-winprops'
+  ;; will have erased any previous property list for this window, but
+  ;; without removing existing overlays for the same, so that they must
+  ;; be located and erased before a new overlay is created.
+  (dolist (tem (car (overlay-lists)))
+    (when (and (eq (overlay-get tem 'window) (car winprops))
+               (overlay-get tem 'doc-view))
+      (delete-overlay tem)))
   (cl-assert (or (eq t (car winprops))
                  (eq (window-buffer (car winprops)) (current-buffer))))
   (let ((ol (image-mode-window-get 'overlay winprops)))