GNU bug report logs -
#32790
27.0.50; point jumps unexpectedly after delete-window
Previous Next
Reported by: Juri Linkov <juri <at> linkov.net>
Date: Thu, 20 Sep 2018 23:57:01 UTC
Severity: minor
Found in version 27.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> 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)
instead.
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.
martin
This bug report was last modified 5 years and 235 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.