all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Madhu <enometh@meer.net>, 31695@debbugs.gnu.org
Subject: bug#31695: bug-gnu-emacs@gnu.org
Date: Thu, 07 Jun 2018 10:39:13 +0200	[thread overview]
Message-ID: <5B18EF31.1080706@gmx.at> (raw)
In-Reply-To: <20180603.101706.47071122.enometh@meer.net>

 > 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





  parent reply	other threads:[~2018-06-07  8:39 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-03  4:47 bug#31695: bug-gnu-emacs@gnu.org Madhu
2018-06-03 12:21 ` martin rudalics
2018-06-03 16:38   ` Eli Zaretskii
2018-06-04 16:29     ` Eli Zaretskii
2018-06-05 13:36       ` martin rudalics
2018-06-04 20:40   ` Gemini Lasswell
2018-06-05 13:37     ` martin rudalics
2018-06-07  8:39 ` martin rudalics [this message]
2018-06-07 15:30   ` Eli Zaretskii
2018-06-08  8:00     ` martin rudalics
2018-06-08  8:18       ` Eli Zaretskii
     [not found]       ` <<83po11vghl.fsf@gnu.org>
2018-06-08 13:58         ` Drew Adams
2018-06-08 14:36           ` Eli Zaretskii
2018-06-08 14:38           ` Robert Pluim
     [not found]       ` <<<83po11vghl.fsf@gnu.org>
     [not found]         ` <<0b7a8176-03d2-4efd-bf60-e193e8433f85@default>
     [not found]           ` <<83a7s5uyzi.fsf@gnu.org>
2018-06-08 14:47             ` Drew Adams
2018-06-14  3:32   ` bug#31695: minibuffer command takes window-point from another frame displaying the same buffer Noam Postavsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5B18EF31.1080706@gmx.at \
    --to=rudalics@gmx.at \
    --cc=31695@debbugs.gnu.org \
    --cc=enometh@meer.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.