* bug#31695: bug-gnu-emacs@gnu.org
@ 2018-06-03 4:47 Madhu
2018-06-03 12:21 ` martin rudalics
2018-06-07 8:39 ` martin rudalics
0 siblings, 2 replies; 16+ messages in thread
From: Madhu @ 2018-06-03 4:47 UTC (permalink / raw)
To: 31695
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.
In GNU Emacs 27.0.50
Repository revision: d2d35febf28632aafb087952fd4c07c2899e21c5
Windowing system distributor 'The X.Org Foundation', version 11.0.11004000
Configured using:
'configure -C --without-all --with-xml2 --with-dbus --with-m17n-flt
--with-libotf --with-xft --without-x-toolkit
--without-toolkit-scroll-bars'
Configured features:
DBUS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT OLDXMENU X11
[snip]
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#31695: bug-gnu-emacs@gnu.org
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 20:40 ` Gemini Lasswell
2018-06-07 8:39 ` martin rudalics
1 sibling, 2 replies; 16+ messages in thread
From: martin rudalics @ 2018-06-03 12:21 UTC (permalink / raw)
To: Madhu, 31695
> 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 works correctly here in Emacs 23.4.1 and is broken in 24.5.50.1.
If Eli doesn't come up with a clue, could someone with a fast machine
please try to bisect this.
Thanks in advance, martin
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#31695: bug-gnu-emacs@gnu.org
2018-06-03 12:21 ` martin rudalics
@ 2018-06-03 16:38 ` Eli Zaretskii
2018-06-04 16:29 ` Eli Zaretskii
2018-06-04 20:40 ` Gemini Lasswell
1 sibling, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2018-06-03 16:38 UTC (permalink / raw)
To: martin rudalics; +Cc: enometh, 31695
> Date: Sun, 03 Jun 2018 14:21:58 +0200
> From: martin rudalics <rudalics@gmx.at>
>
> This works correctly here in Emacs 23.4.1 and is broken in 24.5.50.1.
It became broken in Emacs 24.3, according to my testing.
> If Eli doesn't come up with a clue, could someone with a fast machine
> please try to bisect this.
Right.
If no one comes up with the culprit, I will look into this tomorrow.
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#31695: bug-gnu-emacs@gnu.org
2018-06-03 16:38 ` Eli Zaretskii
@ 2018-06-04 16:29 ` Eli Zaretskii
2018-06-05 13:36 ` martin rudalics
0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2018-06-04 16:29 UTC (permalink / raw)
To: rudalics; +Cc: enometh, 31695
> Date: Sun, 03 Jun 2018 19:38:23 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: enometh@meer.net, 31695@debbugs.gnu.org
>
> > Date: Sun, 03 Jun 2018 14:21:58 +0200
> > From: martin rudalics <rudalics@gmx.at>
> >
> > This works correctly here in Emacs 23.4.1 and is broken in 24.5.50.1.
>
> It became broken in Emacs 24.3, according to my testing.
>
> > If Eli doesn't come up with a clue, could someone with a fast machine
> > please try to bisect this.
>
> Right.
>
> If no one comes up with the culprit, I will look into this tomorrow.
I took a look, but as expected, got lost among twisted little
passages, all alike. It looks like the problem might be with the
insane dance we perform when entering recursive edit in the
minibuffer, where we save and restore the window configuration of the
selected frame, and also of the frame that serves as the minibuffer
frame for the selected frame. Another potential culprit is
select_window_1, which added the call to set_point_from_marker at its
end, something that wasn't there in Emacs 24.2.
In any case, the immediate cause of the problem is that when redisplay
is entered the offending window is selected and has its point set at
BOB. So redisplays redraws it accordingly.
Btw, note that if you modify the recipe to do it from frame $a, the
problem doesn't happen. Which seems to imply that this is somehow
related to the order in which redisplay redraws frames. I think.
Let me know if I can help more.
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#31695: bug-gnu-emacs@gnu.org
2018-06-03 12:21 ` martin rudalics
2018-06-03 16:38 ` Eli Zaretskii
@ 2018-06-04 20:40 ` Gemini Lasswell
2018-06-05 13:37 ` martin rudalics
1 sibling, 1 reply; 16+ messages in thread
From: Gemini Lasswell @ 2018-06-04 20:40 UTC (permalink / raw)
To: martin rudalics; +Cc: Madhu, 31695
martin rudalics <rudalics@gmx.at> writes:
> This works correctly here in Emacs 23.4.1 and is broken in 24.5.50.1.
> If Eli doesn't come up with a clue, could someone with a fast machine
> please try to bisect this.
I bisected and got this:
c4b6914d3621942393a3a69d5cee3e39e13c6227 is the first bad commit
commit c4b6914d3621942393a3a69d5cee3e39e13c6227
Author: Martin Rudalics <rudalics@gmx.at>
Date: Mon Aug 27 10:31:19 2012 +0200
Address two problems in Fset_window_configuration (Bug#8789) and (Bug#12208).
* window.c (Fset_window_configuration): Record any window's old
buffer if it's replaced (see Bug#8789). If the new current
buffer doesn't appear in the selected window, go to its old
point (Bug#12208).
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#31695: bug-gnu-emacs@gnu.org
2018-06-04 16:29 ` Eli Zaretskii
@ 2018-06-05 13:36 ` martin rudalics
0 siblings, 0 replies; 16+ messages in thread
From: martin rudalics @ 2018-06-05 13:36 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: enometh, 31695
> I took a look, but as expected, got lost among twisted little
> passages, all alike. It looks like the problem might be with the
> insane dance we perform when entering recursive edit in the
> minibuffer, where we save and restore the window configuration of the
> selected frame, and also of the frame that serves as the minibuffer
> frame for the selected frame.
This is indeed a very troublesome aspect because we restore the
current buffer (which is per se not related to window configurations)
twice. Basically, it should suffice to save/restore selected frame
and current buffer around saving/restoring the configuration of the
minibuffer frame, but I'm afraid that this might lead to subtle
changes that would go undetected for another six years.
The real problem is described in this comment
/* BUF_PT (XBUFFER (new_current_buffer)) gives us the position of
point in new_current_buffer as of the last time this buffer was
used. This can be non-deterministic since it can be changed by
things like jit-lock by mere temporary selection of some random
window that happens to show this buffer.
So if possible we want this arbitrary choice of "which point" to
be the one from the to-be-selected-window so as to prevent this
window's cursor from being copied from another window. */
and indeed my change which causes the current bug executes
old_point = BUF_PT (XBUFFER (new_current_buffer));
and later does
if (!EQ (XWINDOW (data->current_window)->contents, new_current_buffer))
Fgoto_char (make_number (old_point));
where old_point is BUF_PT obtained from the other frame showing NEWS -
the one at BOB. And it does this when restoring the configuration of
the minibuffer frame. When restoring the NEWS frame the wrong setting
is already cast. Replacing the last two lines with
if (!EQ (XWINDOW (selected_window)->contents, new_current_buffer))
Fgoto_char (make_number (old_point));
fixes both the present bug and the behavior from Bug#12208 so if I do
not find a better solution I intend to use that. IMHO the idea behind
new_current_buffer = data->f_current_buffer;
is inherently botched when restoring a frame where that buffer appears
on another frame.
> Another potential culprit is
> select_window_1, which added the call to set_point_from_marker at its
> end, something that wasn't there in Emacs 24.2.
This might be related but I have not found any impact yet.
> In any case, the immediate cause of the problem is that when redisplay
> is entered the offending window is selected and has its point set at
> BOB. So redisplays redraws it accordingly.
>
> Btw, note that if you modify the recipe to do it from frame $a, the
> problem doesn't happen. Which seems to imply that this is somehow
> related to the order in which redisplay redraws frames. I think.
I'm quite sure this is the case. To make it happen from $a you have
to set the window point of $b first, then in $a choose another window
point and then start the minibuffer rigmarole.
martin
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#31695: bug-gnu-emacs@gnu.org
2018-06-04 20:40 ` Gemini Lasswell
@ 2018-06-05 13:37 ` martin rudalics
0 siblings, 0 replies; 16+ messages in thread
From: martin rudalics @ 2018-06-05 13:37 UTC (permalink / raw)
To: Gemini Lasswell; +Cc: Madhu, 31695
> I bisected and got this:
>
> c4b6914d3621942393a3a69d5cee3e39e13c6227 is the first bad commit
> commit c4b6914d3621942393a3a69d5cee3e39e13c6227
> Author: Martin Rudalics <rudalics@gmx.at>
> Date: Mon Aug 27 10:31:19 2012 +0200
>
> Address two problems in Fset_window_configuration (Bug#8789) and (Bug#12208).
>
> * window.c (Fset_window_configuration): Record any window's old
> buffer if it's replaced (see Bug#8789). If the new current
> buffer doesn't appear in the selected window, go to its old
> point (Bug#12208).
Thank you very much for the work. I would have spent a couple of
hours doing that here.
martin
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#31695: bug-gnu-emacs@gnu.org
2018-06-03 4:47 bug#31695: bug-gnu-emacs@gnu.org Madhu
2018-06-03 12:21 ` martin rudalics
@ 2018-06-07 8:39 ` martin rudalics
2018-06-07 15:30 ` Eli Zaretskii
2018-06-14 3:32 ` bug#31695: minibuffer command takes window-point from another frame displaying the same buffer Noam Postavsky
1 sibling, 2 replies; 16+ messages in thread
From: martin rudalics @ 2018-06-07 8:39 UTC (permalink / raw)
To: Madhu, 31695
> 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
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#31695: bug-gnu-emacs@gnu.org
2018-06-07 8:39 ` martin rudalics
@ 2018-06-07 15:30 ` Eli Zaretskii
2018-06-08 8:00 ` martin rudalics
2018-06-14 3:32 ` bug#31695: minibuffer command takes window-point from another frame displaying the same buffer Noam Postavsky
1 sibling, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2018-06-07 15:30 UTC (permalink / raw)
To: martin rudalics; +Cc: enometh, 31695
> Date: Thu, 07 Jun 2018 10:39:13 +0200
> From: martin rudalics <rudalics@gmx.at>
>
> > 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.
Are you sure it's a good idea to put this on the emacs-26 branch?
This bug is a mere annoyance, and happens with quite a peculiar frame
configuration that's probably rarely used, judging by the time it took
us to collect only 2 reports about it, since the bug was introduced.
OTOH, we have a somewhat poor record regarding correctness in that
area, so it's quite possible this fix introduces some new issue.
So unless you are really, REALLY sure this should go to emacs-26, I'd
prefer to have it on master, and let the dust settle on it before we
decide it's TRT.
Thanks for working on this and for finding a fix.
> Belated thanks for the simple recipe, martin
Seconded.
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#31695: bug-gnu-emacs@gnu.org
2018-06-07 15:30 ` Eli Zaretskii
@ 2018-06-08 8:00 ` martin rudalics
2018-06-08 8:18 ` Eli Zaretskii
` (2 more replies)
0 siblings, 3 replies; 16+ messages in thread
From: martin rudalics @ 2018-06-08 8:00 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: enometh, 31695
> Are you sure it's a good idea to put this on the emacs-26 branch?
Yes. As you can see from the comment back then
/* If the new current buffer doesn't appear in the selected
window, go to its old point (see bug#12208). */
if (!EQ (XWINDOW (data->current_window)->contents, new_current_buffer))
that fix was based on the wrong assumption that data->current_window
_is_ the selected window. It is not when data->current_window is not
on the selected frame. That was a thinko and the fix on Emacs 26
corrects it.
> This bug is a mere annoyance, and happens with quite a peculiar frame
> configuration that's probably rarely used, judging by the time it took
> us to collect only 2 reports about it, since the bug was introduced.
> OTOH, we have a somewhat poor record regarding correctness in that
> area, so it's quite possible this fix introduces some new issue.
Maybe we didn't get more reports because some people thought that the
"annoyance" is the expected behavior. Even the OP was "hesitant" to
file the report.
> So unless you are really, REALLY sure this should go to emacs-26, I'd
> prefer to have it on master, and let the dust settle on it before we
> decide it's TRT.
The only justifiable alternative I see is to revert the fix for
Bug#12208 on Emacs 26 since that bug is even more obscure than the
present one.
But whatever you decide the responsibility will be all mine.
martin
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#31695: bug-gnu-emacs@gnu.org
2018-06-08 8:00 ` martin rudalics
@ 2018-06-08 8:18 ` Eli Zaretskii
[not found] ` <<83po11vghl.fsf@gnu.org>
[not found] ` <<<83po11vghl.fsf@gnu.org>
2 siblings, 0 replies; 16+ messages in thread
From: Eli Zaretskii @ 2018-06-08 8:18 UTC (permalink / raw)
To: martin rudalics; +Cc: enometh, 31695
> Date: Fri, 08 Jun 2018 10:00:42 +0200
> From: martin rudalics <rudalics@gmx.at>
> CC: enometh@meer.net, 31695@debbugs.gnu.org
>
> > So unless you are really, REALLY sure this should go to emacs-26, I'd
> > prefer to have it on master, and let the dust settle on it before we
> > decide it's TRT.
>
> The only justifiable alternative I see is to revert the fix for
> Bug#12208 on Emacs 26 since that bug is even more obscure than the
> present one.
I see no reason to revert the fix for 12208, so emacs-26 it is.
Thanks.
> But whatever you decide the responsibility will be all mine.
That's not what I was worried about ;-)
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#31695: bug-gnu-emacs@gnu.org
[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
0 siblings, 2 replies; 16+ messages in thread
From: Drew Adams @ 2018-06-08 13:58 UTC (permalink / raw)
To: Eli Zaretskii, martin rudalics; +Cc: enometh, 31695
Could this bug title please be changed to reflect what
the bug is about? Perhaps return to a title similar
to the other bug(s) that were merged with this one?
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#31695: bug-gnu-emacs@gnu.org
2018-06-08 13:58 ` Drew Adams
@ 2018-06-08 14:36 ` Eli Zaretskii
2018-06-08 14:38 ` Robert Pluim
1 sibling, 0 replies; 16+ messages in thread
From: Eli Zaretskii @ 2018-06-08 14:36 UTC (permalink / raw)
To: Drew Adams; +Cc: enometh, 31695
> Date: Fri, 8 Jun 2018 06:58:39 -0700 (PDT)
> From: Drew Adams <drew.adams@oracle.com>
> Cc: enometh@meer.net, 31695@debbugs.gnu.org
>
> Could this bug title please be changed to reflect what
> the bug is about? Perhaps return to a title similar
> to the other bug(s) that were merged with this one?
The bug report didn't lose its title, it's just that email messages
did.
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#31695: bug-gnu-emacs@gnu.org
2018-06-08 13:58 ` Drew Adams
2018-06-08 14:36 ` Eli Zaretskii
@ 2018-06-08 14:38 ` Robert Pluim
1 sibling, 0 replies; 16+ messages in thread
From: Robert Pluim @ 2018-06-08 14:38 UTC (permalink / raw)
To: Drew Adams; +Cc: 31695, enometh
Drew Adams <drew.adams@oracle.com> writes:
> Could this bug title please be changed to reflect what
> the bug is about? Perhaps return to a title similar
> to the other bug(s) that were merged with this one?
Noam retitled it on Sunday
Robert
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#31695: bug-gnu-emacs@gnu.org
[not found] ` <<83a7s5uyzi.fsf@gnu.org>
@ 2018-06-08 14:47 ` Drew Adams
0 siblings, 0 replies; 16+ messages in thread
From: Drew Adams @ 2018-06-08 14:47 UTC (permalink / raw)
To: Eli Zaretskii, Drew Adams; +Cc: enometh, 31695
> > Could this bug title please be changed to reflect what
> > the bug is about? Perhaps return to a title similar
> > to the other bug(s) that were merged with this one?
>
> The bug report didn't lose its title, it's just that email messages
> did.
I see. Could the email Subject please be changed, in that case?
^ permalink raw reply [flat|nested] 16+ messages in thread
* bug#31695: minibuffer command takes window-point from another frame displaying the same buffer
2018-06-07 8:39 ` martin rudalics
2018-06-07 15:30 ` Eli Zaretskii
@ 2018-06-14 3:32 ` Noam Postavsky
1 sibling, 0 replies; 16+ messages in thread
From: Noam Postavsky @ 2018-06-14 3:32 UTC (permalink / raw)
To: martin rudalics; +Cc: Madhu, 31695
tags 31695 fixed
close 31695 26.2
quit
martin rudalics <rudalics@gmx.at> writes:
> This should be fixed now on the Emacs 26.2 release branch.
Works for me.
[1: 26b52ac40e]: 2018-06-07 09:59:38 +0200
Fix unexpected jumps of window-point in 'set-window-configuration' (Bug#31695)
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=26b52ac40e78cb7ac3df3bf87e514ad137f0ce10
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2018-06-14 3:32 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).