emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r109789: Address two problems in Fset


From: martin rudalics
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r109789: Address two problems in Fset_window_configuration (Bug#8789) and (Bug#12208).
Date: Mon, 27 Aug 2012 10:31:19 +0200
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 109789
committer: martin rudalics <address@hidden>
branch nick: trunk
timestamp: Mon 2012-08-27 10:31:19 +0200
message:
  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).
modified:
  src/ChangeLog
  src/window.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-08-27 04:15:33 +0000
+++ b/src/ChangeLog     2012-08-27 08:31:19 +0000
@@ -1,3 +1,10 @@
+2012-08-27  Martin Rudalics  <address@hidden>
+
+       * 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).
+
 2012-08-27  Dmitry Antipov  <address@hidden>
 
        Special MEM_TYPE_SPARE to denote reserved memory.

=== modified file 'src/window.c'
--- a/src/window.c      2012-08-26 10:04:27 +0000
+++ b/src/window.c      2012-08-27 08:31:19 +0000
@@ -1969,6 +1969,9 @@
      is actually stored in that buffer, and the window's pointm isn't used.
      So don't clobber point in that buffer.  */
   if (! EQ (buf, XWINDOW (selected_window)->buffer)
+      /* Don't clobber point in current buffer either (this could be
+        useful in connection with bug#12208).
+      && XBUFFER (buf) != current_buffer  */
       /* This line helps to fix Horsley's testbug.el bug.  */
       && !(WINDOWP (BVAR (b, last_selected_window))
           && w != XWINDOW (BVAR (b, last_selected_window))
@@ -3135,7 +3138,7 @@
 DEFUN ("run-window-configuration-change-hook", 
Frun_window_configuration_change_hook,
        Srun_window_configuration_change_hook, 1, 1, 0,
        doc: /* Run `window-configuration-change-hook' for FRAME.  */)
-     (Lisp_Object frame)
+  (Lisp_Object frame)
 {
   CHECK_LIVE_FRAME (frame);
   run_window_configuration_change_hook (XFRAME (frame));
@@ -5613,6 +5616,24 @@
       int previous_frame_menu_bar_lines = FRAME_MENU_BAR_LINES (f);
       int previous_frame_tool_bar_lines = FRAME_TOOL_BAR_LINES (f);
 
+      /* Don't do this within the main loop below: This may call Lisp
+        code and is thus potentially unsafe while input is blocked.  */
+      for (k = 0; k < saved_windows->header.size; k++)
+       {
+         p = SAVED_WINDOW_N (saved_windows, k);
+         window = p->window;
+         w = XWINDOW (window);
+
+         if (!NILP (p->buffer)
+             && ((!EQ (w->buffer, p->buffer)
+                  && !NILP (BVAR (XBUFFER (p->buffer), name)))
+                 || NILP (w->buffer)
+                 || NILP (BVAR (XBUFFER (w->buffer), name))))
+           /* Record old buffer of window when its buffer is going to
+              change.  */
+           call1 (Qrecord_window_buffer, window);
+       }
+
       /* The mouse highlighting code could get screwed up
         if it runs during this.  */
       BLOCK_INPUT;
@@ -5900,7 +5921,13 @@
     }
 
   if (!NILP (new_current_buffer))
-    Fset_buffer (new_current_buffer);
+    {
+      Fset_buffer (new_current_buffer);
+      /* 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)->buffer, new_current_buffer))
+       Fgoto_char (make_number (old_point));
+    }
 
   Vminibuf_scroll_window = data->minibuf_scroll_window;
   minibuf_selected_window = data->minibuf_selected_window;


reply via email to

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