[Top][All Lists]

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

bug#12208: yes-or-no-p escapes with-current-buffer

From: martin rudalics
Subject: bug#12208: yes-or-no-p escapes with-current-buffer
Date: Fri, 17 Aug 2012 14:09:38 +0200

> Thanks for the examples.

I wrote them as a first step in order to uncouple the behavior you
observed from `yes-or-no-p'.

> If I understand correctly,
> save-window-excursion ends with among other things restoring the
> window points; and each time a window point is set, the buffer point
> is set as well.

Conceptually, for any non-selected window, it should restore
`window-point' but leave `point' for that window's buffer alone.  For
the selected window, it should leave `point' where it is.  The problem
seems to occur only when the selected window's buffer is not current at
the time the configuration is saved.

> And while the current buffer is restored,
> save-window-excursion does not restore the point in the current
> buffer, leaving it at the position set by the window point restore, if
> there was one.

Did you read the code?  Can you tell me where it does do that "window
point restore" which also sets the buffer's `point'?

> What I don't understand is the rationale for not
> restoring the current buffer point. Perhaps it's just windows have
> precedence in a restore.

I've never been able to fully understand neither the purpose nor the
actual implementation of this.  The patch below seems to make it go away
in your case but I have no idea whether it breaks something else.


=== modified file 'src/window.c'
--- src/window.c        2012-08-16 07:58:24 +0000
+++ src/window.c        2012-08-17 11:56:55 +0000
@@ -5636,8 +5636,9 @@
               /* As documented in Fcurrent_window_configuration, don't
                  restore the location of point in the buffer which was
                  current when the window configuration was recorded.  */
-              if (!EQ (p->buffer, new_current_buffer)
-                  && XBUFFER (p->buffer) == current_buffer)
+              if (EQ (p->buffer, new_current_buffer))
+                Fgoto_char (make_number (old_point));
+              else if (XBUFFER (p->buffer) == current_buffer)
                 Fgoto_char (w->pointm);
           else if (!NILP (w->buffer)

reply via email to

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