[Top][All Lists]

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

bug#32790: 27.0.50; point jumps unexpectedly after delete-window

From: martin rudalics
Subject: bug#32790: 27.0.50; point jumps unexpectedly after delete-window
Date: Mon, 05 Nov 2018 10:35:35 +0100

> Actually there is some problem with the third argument 'window' of
> window--display-buffer:
> 0. emacs -Q
> 1. C-h e
>     displays *Messages* in another window
> 2. in *scratch* eval:
>     (window--display-buffer (get-buffer-create "test1") (next-window) 'window)
>     displays "test1" in the window where *Messages* was displayed
> 3. C-x o
>     select the window with "test1"
> 4. M-: (quit-window 1)
>     the window is deleted.
> I'd expect that it shouldn't delete the window, but should restore the
> buffer previously displayed in that window, i.e. the *Messages* buffer,
> because this is what quit-window does when the "test1" buffer was created
> manually with e.g. 'C-x b test1'.

That's because you told 'window--display-buffer' a lie: You did _not_
create a new window but reused an existing one.  Try with

(window--display-buffer (get-buffer-create "test1") (next-window) 'reuse)


Ideally, 'window--display-buffer' would find out itself whether a new
window or frame was made or an existing one reused.  But for that
purpose 'display-buffer' would have to store away the identity of all
windows and frames that existed before any action function was called
so 'window--display-buffer' could compare these against the state
after display.

I earlier used such a solution in 'display-buffer-pretend' and may
revive it if that function ever gets installed.  But for normal
'display-buffer' the overhead is somehow annoying.


reply via email to

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