emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r111260: * src/xdisp.c (select_frame_


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111260: * src/xdisp.c (select_frame_for_redisplay): Use select_window_1 to
Date: Mon, 17 Dec 2012 14:17:06 -0500
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111260
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Mon 2012-12-17 14:17:06 -0500
message:
  * src/xdisp.c (select_frame_for_redisplay): Use select_window_1 to
  propagate redisplay's scrolling (if any) to the right window.
  (redisplay_internal): Use ensure_selected_frame.
  (display_mode_lines): Complete last fix.
  * src/window.c (select_window_1): New func, extracted from select_window.
  (select_window): Use it.
  * src/window.h (select_window_1): Declare.
modified:
  src/ChangeLog
  src/window.c
  src/window.h
  src/xdisp.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-12-17 19:14:34 +0000
+++ b/src/ChangeLog     2012-12-17 19:17:06 +0000
@@ -1,3 +1,13 @@
+2012-12-17  Stefan Monnier  <address@hidden>
+
+       * xdisp.c (select_frame_for_redisplay): Use select_window_1 to
+       propagate redisplay's scrolling (if any) to the right window.
+       (redisplay_internal): Use ensure_selected_frame.
+       (display_mode_lines): Complete last fix.
+       * window.c (select_window_1): New func, extracted from select_window.
+       (select_window): Use it.
+       * window.h (select_window_1): Declare.
+
 2012-12-17  Eli Zaretskii  <address@hidden>
 
        Emulate Posix ACL APIs on MS-Windows.
@@ -42,8 +52,7 @@
 
        * fileio.c (Ffile_acl, Fset_file_acl): New functions.
        (Fcopy_file): Change last arg to `preserve_extended_attributes'
-       and copy ACL entries of file in addition to SELinux context if
-       set.
+       and copy ACL entries of file in addition to SELinux context if set.
        (syms_of_fileio): Add `file-acl' and `set-file-acl'.
 
        * Makefile.in (LIBACL_LIBS): New macro.
@@ -166,7 +175,7 @@
 
 2012-12-12  Daniel Colascione  <address@hidden>
 
-       * unexcw.c (fixup_executable): use posix_fallocate to ensure that
+       * unexcw.c (fixup_executable): Use posix_fallocate to ensure that
        the dumped Emacs is not a sparse file, greatly improving Cygwin
        "make bootstrap" performance.
 
@@ -235,8 +244,7 @@
        * w32fns.c (cache_system_info): Initialize the global hinst
        variable here so various initialization calls DTRT.
 
-       * unexw32.c (hprevinst, lpCmdLine, nCmdShow): Remove unused
-       variables.
+       * unexw32.c (hprevinst, lpCmdLine, nCmdShow): Remove unused variables.
        (hinst): Remove unneeded extern declaration.
        (_start): Remove initialization of above variables; remove
        initialization of hinst, as cache_system_info now does that.
@@ -308,8 +316,7 @@
        * w32fns.c (w32_wnd_proc): Handle the WM_EMACS_FILENOTIFY message
        by posting it to the w32_read_socket queue.
 
-       * termhooks.h (enum event_kind) [HAVE_NTGUI]: Support
-       FILE_NOTIFY_EVENT.
+       * termhooks.h (enum event_kind) [HAVE_NTGUI]: Support FILE_NOTIFY_EVENT.
 
        * makefile.w32-in (OBJ2): Add $(BLD)/w32notify.$(O).
        (GLOBAL_SOURCES): Add w32notify.c
@@ -317,8 +324,8 @@
 
        * lisp.h (syms_of_w32notify) [WINDOWSNT]: Add prototype.
 
-       * keyboard.c (kbd_buffer_get_event) [WINDOWSNT]: Handle
-       FILE_NOTIFY_EVENT.
+       * keyboard.c (kbd_buffer_get_event) [WINDOWSNT]:
+       Handle FILE_NOTIFY_EVENT.
        (syms_of_keyboard) [HAVE_NTGUI] <Qfile_notify>: New symbol.
        (keys_of_keyboard) [WINDOWSNT]: Bind file-notify to
        w32notify-handle-event by default.
@@ -329,8 +336,7 @@
 2012-12-10  Rüdiger Sonderfeld  <address@hidden>
 
        Support for filesystem notifications on GNU/Linux via inotify.
-       * termhooks.h (enum event_kind) [HAVE_INOTIFY]: Add
-       FILE_NOTIFY_EVENT.
+       * termhooks.h (enum event_kind) [HAVE_INOTIFY]: Add FILE_NOTIFY_EVENT.
 
        * lisp.h (syms_of_inotify) [HAVE_INOTIFY]: Add prototype.
 
@@ -647,9 +653,9 @@
 2012-12-03  Fabrice Popineau  <address@hidden>
 
        * w32fns.c: Remove prototype of atof.
-       (syspage_mask): Declared DWORD_PTR, for compatibility with 64-bit
+       (syspage_mask): Make it DWORD_PTR, for compatibility with 64-bit
        builds.
-       (file_dialog_callback): Declared UINT_PTR.
+       (file_dialog_callback): Make it UINT_PTR.
 
        * w32common.h (syspage_mask): Declare DWORD_PTR, for compatibility
        with 64-bit builds.

=== modified file 'src/window.c'
--- a/src/window.c      2012-12-12 15:33:30 +0000
+++ b/src/window.c      2012-12-17 19:17:06 +0000
@@ -487,7 +487,6 @@
 select_window (Lisp_Object window, Lisp_Object norecord, int 
inhibit_point_swap)
 {
   register struct window *w;
-  register struct window *ow;
   struct frame *sf;
 
   CHECK_LIVE_WINDOW (window);
@@ -523,12 +522,25 @@
   else
     fset_selected_window (sf, window);
 
+  select_window_1 (window, inhibit_point_swap);
+
+  bset_last_selected_window (XBUFFER (w->buffer), window);
+  windows_or_buffers_changed++;
+  return window;
+}
+
+/* Select window with a minimum of fuss, i.e. don't record the change anywhere
+   (not even for rediaplay's benefit), and assume that the window's frame is
+   already selected.  */
+void
+select_window_1 (Lisp_Object window, bool inhibit_point_swap)
+{
   /* Store the old selected window's buffer's point in pointm of the old
      selected window.  It belongs to that window, and when the window is
      not selected, must be in the window.  */
   if (!inhibit_point_swap)
     {
-      ow = XWINDOW (selected_window);
+      struct window *ow = XWINDOW (selected_window);
       if (! NILP (ow->buffer))
        set_marker_both (ow->pointm, ow->buffer,
                         BUF_PT (XBUFFER (ow->buffer)),
@@ -536,7 +548,6 @@
     }
 
   selected_window = window;
-  bset_last_selected_window (XBUFFER (w->buffer), window);
 
   /* Go to the point recorded in the window.
      This is important when the buffer is in more
@@ -544,7 +555,7 @@
      redisplay_window has altered point after scrolling,
      because it makes the change only in the window.  */
   {
-    register ptrdiff_t new_point = marker_position (w->pointm);
+    register ptrdiff_t new_point = marker_position (XWINDOW (window)->pointm);
     if (new_point < BEGV)
       SET_PT (BEGV);
     else if (new_point > ZV)
@@ -552,9 +563,6 @@
     else
       SET_PT (new_point);
   }
-
-  windows_or_buffers_changed++;
-  return window;
 }
 
 DEFUN ("select-window", Fselect_window, Sselect_window, 1, 2, 0,

=== modified file 'src/window.h'
--- a/src/window.h      2012-12-10 17:34:47 +0000
+++ b/src/window.h      2012-12-17 19:17:06 +0000
@@ -261,7 +261,7 @@
     EMACS_INT last_overlay_modified;
 
     /* Value of point at that time.  Since this is a position in a buffer,
-       it should be positive. */
+       it should be positive.  */
     ptrdiff_t last_point;
 
     /* Scaling factor for the glyph_matrix size calculation in this window.
@@ -290,7 +290,7 @@
     /* Non-zero if this window is a minibuffer window.  */
     unsigned mini : 1;
 
-    /* Non-zero means must regenerate mode line of this window */
+    /* Non-zero means must regenerate mode line of this window.  */
     unsigned update_mode_line : 1;
 
     /* Non-nil if the buffer was "modified" when the window
@@ -343,7 +343,7 @@
        y-direction (smooth scrolling).  */
     int vscroll;
 
-    /* Z_BYTE - the buffer position of the last glyph in the current matrix of 
W.
+    /* Z_BYTE - Buffer position of the last glyph in the current matrix of W.
        Should be nonnegative, and only valid if window_end_valid is not nil.  
*/
     ptrdiff_t window_end_bytepos;
 };
@@ -934,7 +934,7 @@
 extern int update_mode_lines;
 
 /* Nonzero if window sizes or contents have changed since last
-   redisplay that finished */
+   redisplay that finished.  */
 
 extern int windows_or_buffers_changed;
 
@@ -978,6 +978,7 @@
 extern Lisp_Object Qwindowp, Qwindow_live_p;
 extern Lisp_Object Vwindow_list;
 
+extern void select_window_1 (Lisp_Object window, bool inhibit_point_swap);
 extern struct window *decode_live_window (Lisp_Object);
 extern struct window *decode_any_window (Lisp_Object);
 extern bool compare_window_configurations (Lisp_Object, Lisp_Object, bool);

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2012-12-14 15:52:43 +0000
+++ b/src/xdisp.c       2012-12-17 19:17:06 +0000
@@ -869,7 +869,6 @@
 static void iterate_out_of_display_property (struct it *);
 static void pop_it (struct it *);
 static void sync_frame_with_window_matrix_rows (struct window *);
-static void select_frame_for_redisplay (Lisp_Object);
 static void redisplay_internal (void);
 static int echo_area_display (int);
 static void redisplay_windows (Lisp_Object);
@@ -1330,7 +1329,7 @@
                           BVAR (current_buffer, header_line_format));
 
   start_display (&it, w, top);
-  move_it_to (&it, charpos, -1, it.last_visible_y-1, -1,
+  move_it_to (&it, charpos, -1, it.last_visible_y - 1, -1,
              (charpos >= 0 ? MOVE_TO_POS : 0) | MOVE_TO_Y);
 
   if (charpos >= 0
@@ -1338,7 +1337,7 @@
           && IT_CHARPOS (it) >= charpos)
          /* When scanning backwards under bidi iteration, move_it_to
             stops at or _before_ CHARPOS, because it stops at or to
-            the _right_ of the character at CHARPOS. */
+            the _right_ of the character at CHARPOS.  */
          || (it.bidi_p && it.bidi_it.scan_dir == -1
              && IT_CHARPOS (it) <= charpos)))
     {
@@ -12966,7 +12965,9 @@
   eassert (FRAMEP (frame) && FRAME_LIVE_P (XFRAME (frame)));
 
   selected_frame = frame;
-  selected_window = XFRAME (frame)->selected_window;
+  /* If redisplay causes scrolling, it sets point in the window, so we need to
+     be careful with the selected-window's point handling.  */
+  select_window_1 (XFRAME (frame)->selected_window, 0);
 
   do {
     for (tail = XFRAME (frame)->param_alist;
@@ -13490,10 +13491,8 @@
 
          if (FRAME_WINDOW_P (f) || FRAME_TERMCAP_P (f) || f == sf)
            {
-             if (! EQ (frame, selected_frame))
-               /* Select the frame, for the sake of frame-local
-                  variables.  */
-               select_frame_for_redisplay (frame);
+             /* Select the frame, for the sake of frame-local variables.  */
+             ensure_selected_frame (frame);
 
              /* Mark all the scroll bars to be removed; we'll redeem
                 the ones we want when we redisplay their windows.  */
@@ -13790,8 +13789,8 @@
     {
       struct buffer *b = XBUFFER (w->buffer);
 
-      w->last_modified = accurate_p ? BUF_MODIFF(b) : 0;
-      w->last_overlay_modified = accurate_p ? BUF_OVERLAY_MODIFF(b) : 0;
+      w->last_modified = accurate_p ? BUF_MODIFF (b) : 0;
+      w->last_overlay_modified = accurate_p ? BUF_OVERLAY_MODIFF (b) : 0;
       w->last_had_star
        = BUF_MODIFF (b) > BUF_SAVE_MODIFF (b);
 
@@ -20360,8 +20359,11 @@
   Lisp_Object old_frame_selected_window = XFRAME (new_frame)->selected_window;
   int n = 0;
 
-  selected_frame = w->frame;
+  selected_frame = new_frame;
+  /* FIXME: If we were to allow the mode-line's computation changing the buffer
+     or window's point, then we'd need select_window_1 here as well.  */
   XSETWINDOW (selected_window, w);
+  XFRAME (new_frame)->selected_window = selected_window;
 
   /* These will be set while the mode line specs are processed.  */
   line_number_displayed = 0;


reply via email to

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