aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier <[email protected]>2005-12-01 16:25:15 +0000
committerStefan Monnier <[email protected]>2005-12-01 16:25:15 +0000
commite67a1dea3e622d61024b2dc17c36831d048bb271 (patch)
treea730701839615c50ac0e53a367401c84548cb5f6
parent9f6efa0c78099f2f028c4db1db5a58567a1cfb4e (diff)
(Fset_window_configuration): Don't accidentally copy the
window-point of one window to another.
-rw-r--r--src/ChangeLog5
-rw-r--r--src/window.c22
2 files changed, 24 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 256172630e..3c06d253cd 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2005-12-01 Stefan Monnier <[email protected]>
+
+ * window.c (Fset_window_configuration): Don't accidentally copy the
+ window-point of one window to another.
+
2005-11-30 L$,1 q(Brentey K,Aa(Broly <[email protected]>
* buffer.c (Fpop_to_buffer): Remove superfluous call to record_buffer.
diff --git a/src/window.c b/src/window.c
index 2e2f6427b5..e2659885f1 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1969,7 +1969,7 @@ window_loop (type, obj, mini, frames)
GCPRO1 (windows);
best_window = Qnil;
- for (; CONSP (windows); windows = CDR (windows))
+ for (; CONSP (windows); windows = XCDR (windows))
{
struct window *w;
@@ -3667,7 +3667,7 @@ temp_output_buffer_show (buf)
#endif
set_buffer_internal (old);
- if (!EQ (Vtemp_buffer_show_function, Qnil))
+ if (!NILP (Vtemp_buffer_show_function))
call1 (Vtemp_buffer_show_function, buf);
else
{
@@ -5831,7 +5831,23 @@ the return value is nil. Otherwise the value is t. */)
else
{
if (XBUFFER (new_current_buffer) == current_buffer)
- old_point = PT;
+ /* The code further down "preserves point" by saving here PT in
+ old_point and then setting it later back into PT. When the
+ current-selected-window and the final-selected-window both show
+ the current buffer, this suffers from the problem that the
+ current PT is the window-point of the current-selected-window,
+ while the final PT is the point of the final-selected-window, so
+ this copy from one PT to the other would end up moving the
+ window-point of the final-selected-window to the window-point of
+ the current-selected-window. So we have to be careful which
+ point of the current-buffer we copy into old_point. */
+ if (EQ (XWINDOW (data->current_window)->buffer, new_current_buffer)
+ && WINDOWP (selected_window)
+ && EQ (XWINDOW (selected_window)->buffer, new_current_buffer)
+ && !EQ (selected_window, data->current_window))
+ old_point = XMARKER (XWINDOW (data->current_window)->pointm)->charpos;
+ else
+ old_point = PT;
else
/* BUF_PT (XBUFFER (new_current_buffer)) gives us the position of
point in new_current_buffer as of the last time this buffer was