bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#31695: address@hidden


From: martin rudalics
Subject: bug#31695: address@hidden
Date: Thu, 07 Jun 2018 10:39:13 +0200

> The window-point jumps unexpectedly after minibuffer interaction when a
> buffer is being displayed in two frames, and the frames do not have
> their own minibuffers.
>
> To reproduce: emacs -Q -D and create two frames displaying some buffer
> at different points
>
> (with-selected-frame (setq $a (make-frame '((minibuffer))))
>    (let ((enable-local-variables :all))
>      (view-emacs-news)
>      (beginning-of-buffer)))
>
> (with-selected-frame (setq $b (make-frame '((minibuffer))))
>    (let ((enable-local-variables :all))
>      (view-emacs-news)
>      (end-of-buffer)))
>
> Now select frame $b, and execute some minibuffer command:
> M-: 1
>
> The point in the window of frame $b, which was at the bottom now jumps
> to the top of the buffer.  (This corresponds with the point in the
> buffer in the other frame where it is displayed.

This should be fixed now on the Emacs 26.2 release branch.  The
precise reason of the bug is yet unknown to me but what happens is the
following: When restoring the configuration of the minibuffer-frame
after execution of the minibuffer command, 'set-window-configuration'
assigns

    old_point = BUF_PT (XBUFFER (new_current_buffer));

because new_current_buffer (which is NEWS) is not the current buffer
(which is *Minibuf-1*) and because data->current_window does not show
NEWS.  I can't tell why BUF_PT gets value from the window showing NEWS
at BOB but a comment in 'set-window-configuration' says that this may
happen.

Note that data->current_window shows *scratch* and this is the window
that will become the minibuffer frame's selected window instead of the
minibuffer window.

Now after data->selected_frame (which is the frame showing NEWS at
EOB) has been reselected, 'set-window-configuration' does

      if (!EQ (XWINDOW (data->current_window)->contents, new_current_buffer))
        Fgoto_char (make_number (old_point));

and since data->current_window shows *scratch* (and not NEWS) going to
old_point will cause the point of the window showing NEWS at EOB show
it at BOB instead.

In my fix I use

      if (!EQ (XWINDOW (selected_window)->contents, new_current_buffer))
        Fgoto_char (make_number (old_point));

instead and since selected_window already shows new_current_buffer at
that time the bug should not happen.

If you build from the release branch, please try it.  If you build
from master only, please wait a few days until the change has been
propagated there.

Belated thanks for the simple recipe, martin





reply via email to

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