Subject: Re: bug#52385: 29.0.50; Doc-View can't view separate pages in separate windows

From: Juri Linkov <[email-masked]>
Date: Thu, 16 Dec 2021 19:04:12 +0200

>>     % emacs -Q some/multi-page.pdf
>>     C-x 2
>>     n n
>>
>> You'll see that the `n` changes the page in both windows.
>> This was not the case in Emacs<29 where this could be used to view
>> different pages of the same PDF in the exact same way we can view
>> different "pages" of a text buffer when displayed in several windows.
>
> It seems window-configuration-change-hook is not called
> after splitting the window with C-x 2, and thus
> image-mode-reapply-winprops is not called from this hook.

Actually, window-configuration-change-hook is called correctly.

But the regression is in overlay window priorities:
when two overlays with 'window' properties are added
over the same region, then in 27.2 the overlay where
the overlay window matches the selected window is preferred
over the overlay with another window.  But in 28.0.90
the first overlay always wins.

Here is the shortest test case:

  (let ((o1 (make-overlay (point-min) (point-max) nil t))
        (o2 (make-overlay (point-min) (point-max) nil t)))
    (overlay-put o1 'window (selected-window))
    (overlay-put o1 'display '(image :type xpm :file "left-arrow.xpm"))
    (select-window (split-window))
    (overlay-put o2 'window (selected-window))
    (overlay-put o2 'display '(image :type xpm :file "right-arrow.xpm")))

In 27.2 it displays different images in different windows.  But
in 28.0.90 only one images is displayed in both windows.