[Top][All Lists]

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

Re: [PATCH] Fix display-buffer-use-some-window to honor reusable-frames

From: martin rudalics
Subject: Re: [PATCH] Fix display-buffer-use-some-window to honor reusable-frames
Date: Sun, 29 Jan 2023 18:39:43 +0100

> Here is an updated patch which does not touch
> 'display-buffer-use-some-window' at all, and that
> corrects splitting behavior and return value for
> 'display-buffer-use-least-recent-window'.

Thanks.  I see the following problems:

+         (window (or (get-lru-window frame nil not-this-window)
+                     (if (not reusable-frames)
+                         (display-buffer-pop-up-window buffer alist)
+                       (window (get-buffer-window buffer reusable-frames)))))

Here the last line gets me

In end of data:
window.el:8522:25: Warning: the function ‘window’ is not known to be defined.

Now if this frame contains more than one window, 'get-lru-window' will
usually (barring not fullwidth, dedicated ... windows) always succeed in
finding a window.  This is probably not the intended behavior if this
frame contains a reusable window - one that shows BUFFER already.  Maybe
you think that some other action function would handle that.  But then
why would you want to handle 'reusable-frames' here at all?

Also 'display-buffer-pop-up-window' is an action function which returns
a window _and_ displays the buffer in it.  So if it succeeds here, you
will end up displaying the buffer twice, once within that function and
once in

+            (window--display-buffer buffer window 'reuse alist)

below.  I can't tell you what consequences that might have but I think
it's a bad idea.  BTW, you don't have to bind 'not-this-window' - just
pass t as last argument to 'get-lru-window'.

+            (window--display-buffer buffer window 'reuse alist)

This would have to become

  (window--display-buffer buffer window 'window alist)

when 'display-buffer-pop-up-window' succeeds.


+        (prog1

has been cargo-culted from 'display-buffer-use-some-window'.  It's of no
use here because you return the window used below.

Finally, please fix the doc-string so it tells what this function really
does (and please leave two spaces between sentences).

Thanks again, martin

reply via email to

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