aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDmitry Antipov2012-11-29 10:00:21 +0400
committerDmitry Antipov2012-11-29 10:00:21 +0400
commit3940b924e7c9da1e01ff16b4797ac75ef6ce8df4 (patch)
treefa146239216d2245ee085b44003b99445dc7bfa6 /src
parent4ad900d9938b142f9a3123e3b536115b51bed24e (diff)
downloademacs-3940b924e7c9da1e01ff16b4797ac75ef6ce8df4.tar.gz
emacs-3940b924e7c9da1e01ff16b4797ac75ef6ce8df4.zip
* xdisp.c (window_outdated): Remove eassert since it hits
some suspicious corner cases (see Bug#13007 and Bug#13012). (mode_line_update_needed): New function. (redisplay_internal, redisplay_window): Use it. (ensure_selected_frame): New function. (redisplay_internal, unwind_redisplay): Use it. (redisplay_internal): Move comment about buffer_shared... (buffer_shared_and_changed): ...near to its real use.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog11
-rw-r--r--src/xdisp.c77
2 files changed, 49 insertions, 39 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index b1c3b0025e1..b19ecc926d0 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,14 @@
12012-11-29 Dmitry Antipov <dmantipov@yandex.ru>
2
3 * xdisp.c (window_outdated): Remove eassert since it hits
4 some suspicious corner cases (see Bug#13007 and Bug#13012).
5 (mode_line_update_needed): New function.
6 (redisplay_internal, redisplay_window): Use it.
7 (ensure_selected_frame): New function.
8 (redisplay_internal, unwind_redisplay): Use it.
9 (redisplay_internal): Move comment about buffer_shared...
10 (buffer_shared_and_changed): ...near to its real use.
11
12012-11-29 Paul Eggert <eggert@cs.ucla.edu> 122012-11-29 Paul Eggert <eggert@cs.ucla.edu>
2 13
3 * callproc.c (Fcall_process): Don't misreport vfork failure. 14 * callproc.c (Fcall_process): Don't misreport vfork failure.
diff --git a/src/xdisp.c b/src/xdisp.c
index 3b19d5d14d4..8cca758c47b 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -10894,16 +10894,18 @@ echo_area_display (int update_frame_p)
10894static int 10894static int
10895buffer_shared_and_changed (void) 10895buffer_shared_and_changed (void)
10896{ 10896{
10897 /* The variable buffer_shared is set in redisplay_window and
10898 indicates that we redisplay a buffer in different windows. */
10897 return (buffer_shared > 1 && UNCHANGED_MODIFIED < MODIFF); 10899 return (buffer_shared > 1 && UNCHANGED_MODIFIED < MODIFF);
10898} 10900}
10899 10901
10900/* Nonzero if W doesn't reflect the actual state of 10902/* Nonzero if W doesn't reflect the actual state of current buffer due
10901 current buffer due to its text or overlays change. */ 10903 to its text or overlays change. FIXME: this may be called when
10904 XBUFFER (w->buffer) != current_buffer, which looks suspicious. */
10902 10905
10903static int 10906static int
10904window_outdated (struct window *w) 10907window_outdated (struct window *w)
10905{ 10908{
10906 eassert (XBUFFER (w->buffer) == current_buffer);
10907 return (w->last_modified < MODIFF 10909 return (w->last_modified < MODIFF
10908 || w->last_overlay_modified < OVERLAY_MODIFF); 10910 || w->last_overlay_modified < OVERLAY_MODIFF);
10909} 10911}
@@ -10923,6 +10925,16 @@ window_buffer_changed (struct window *w)
10923 != !NILP (w->region_showing))); 10925 != !NILP (w->region_showing)));
10924} 10926}
10925 10927
10928/* Nonzero if W has %c in its mode line and mode line should be updated. */
10929
10930static int
10931mode_line_update_needed (struct window *w)
10932{
10933 return (!NILP (w->column_number_displayed)
10934 && !(PT == w->last_point && !window_outdated (w))
10935 && (XFASTINT (w->column_number_displayed) != current_column ()));
10936}
10937
10926/*********************************************************************** 10938/***********************************************************************
10927 Mode Lines and Frame Titles 10939 Mode Lines and Frame Titles
10928 ***********************************************************************/ 10940 ***********************************************************************/
@@ -12967,6 +12979,15 @@ select_frame_for_redisplay (Lisp_Object frame)
12967 } while (!EQ (frame, old) && (frame = old, 1)); 12979 } while (!EQ (frame, old) && (frame = old, 1));
12968} 12980}
12969 12981
12982/* Make sure that previously selected OLD_FRAME is selected unless it has been
12983 deleted (by an X connection failure during redisplay, for example). */
12984
12985static void
12986ensure_selected_frame (Lisp_Object old_frame)
12987{
12988 if (!EQ (old_frame, selected_frame) && FRAME_LIVE_P (XFRAME (old_frame)))
12989 select_frame_for_redisplay (old_frame);
12990}
12970 12991
12971#define STOP_POLLING \ 12992#define STOP_POLLING \
12972do { if (! polling_stopped_here) stop_polling (); \ 12993do { if (! polling_stopped_here) stop_polling (); \
@@ -13052,13 +13073,11 @@ redisplay_internal (void)
13052 /* Remember the currently selected window. */ 13073 /* Remember the currently selected window. */
13053 sw = w; 13074 sw = w;
13054 13075
13055 if (!EQ (old_frame, selected_frame) 13076 /* When running redisplay, we play a bit fast-and-loose and allow e.g.
13056 && FRAME_LIVE_P (XFRAME (old_frame))) 13077 selected_frame and selected_window to be temporarily out-of-sync so
13057 /* When running redisplay, we play a bit fast-and-loose and allow e.g. 13078 when we come back here via `goto retry', we need to resync because we
13058 selected_frame and selected_window to be temporarily out-of-sync so 13079 may need to run Elisp code (via prepare_menu_bars). */
13059 when we come back here via `goto retry', we need to resync because we 13080 ensure_selected_frame (old_frame);
13060 may need to run Elisp code (via prepare_menu_bars). */
13061 select_frame_for_redisplay (old_frame);
13062 13081
13063 pending = 0; 13082 pending = 0;
13064 reconsider_clip_changes (w, current_buffer); 13083 reconsider_clip_changes (w, current_buffer);
@@ -13144,21 +13163,13 @@ redisplay_internal (void)
13144 count1 = SPECPDL_INDEX (); 13163 count1 = SPECPDL_INDEX ();
13145 specbind (Qinhibit_point_motion_hooks, Qt); 13164 specbind (Qinhibit_point_motion_hooks, Qt);
13146 13165
13147 /* If %c is in the mode line, update it if needed. */ 13166 if (mode_line_update_needed (w))
13148 if (!NILP (w->column_number_displayed)
13149 /* This alternative quickly identifies a common case
13150 where no change is needed. */
13151 && !(PT == w->last_point && !window_outdated (w))
13152 && (XFASTINT (w->column_number_displayed) != current_column ()))
13153 w->update_mode_line = 1; 13167 w->update_mode_line = 1;
13154 13168
13155 unbind_to (count1, Qnil); 13169 unbind_to (count1, Qnil);
13156 13170
13157 FRAME_SCROLL_BOTTOM_VPOS (XFRAME (w->frame)) = -1; 13171 FRAME_SCROLL_BOTTOM_VPOS (XFRAME (w->frame)) = -1;
13158 13172
13159 /* The variable buffer_shared is set in redisplay_window and
13160 indicates that we redisplay a buffer in different windows. See
13161 there. */
13162 consider_all_windows_p = (update_mode_lines 13173 consider_all_windows_p = (update_mode_lines
13163 || buffer_shared_and_changed () 13174 || buffer_shared_and_changed ()
13164 || cursor_type_changed); 13175 || cursor_type_changed);
@@ -13533,14 +13544,11 @@ redisplay_internal (void)
13533 } 13544 }
13534 } 13545 }
13535 13546
13536 if (!EQ (old_frame, selected_frame) 13547 /* We played a bit fast-and-loose above and allowed selected_frame
13537 && FRAME_LIVE_P (XFRAME (old_frame))) 13548 and selected_window to be temporarily out-of-sync but let's make
13538 /* We played a bit fast-and-loose above and allowed selected_frame 13549 sure this stays contained. */
13539 and selected_window to be temporarily out-of-sync but let's make 13550 ensure_selected_frame (old_frame);
13540 sure this stays contained. */ 13551 eassert (EQ (XFRAME (selected_frame)->selected_window, selected_window));
13541 select_frame_for_redisplay (old_frame);
13542 eassert (EQ (XFRAME (selected_frame)->selected_window,
13543 selected_window));
13544 13552
13545 if (!pending) 13553 if (!pending)
13546 { 13554 {
@@ -13759,17 +13767,13 @@ redisplay_preserve_echo_area (int from_where)
13759 13767
13760 13768
13761/* Function registered with record_unwind_protect in redisplay_internal. 13769/* Function registered with record_unwind_protect in redisplay_internal.
13762 Clear redisplaying_p. Also, select the previously 13770 Clear redisplaying_p. Also select the previously selected frame. */
13763 selected frame, unless it has been deleted (by an X connection
13764 failure during redisplay, for example). */
13765 13771
13766static Lisp_Object 13772static Lisp_Object
13767unwind_redisplay (Lisp_Object old_frame) 13773unwind_redisplay (Lisp_Object old_frame)
13768{ 13774{
13769 redisplaying_p = 0; 13775 redisplaying_p = 0;
13770 if (! EQ (old_frame, selected_frame) 13776 ensure_selected_frame (old_frame);
13771 && FRAME_LIVE_P (XFRAME (old_frame)))
13772 select_frame_for_redisplay (old_frame);
13773 return Qnil; 13777 return Qnil;
13774} 13778}
13775 13779
@@ -15565,12 +15569,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15565 if (BYTEPOS (opoint) < CHARPOS (opoint)) 15569 if (BYTEPOS (opoint) < CHARPOS (opoint))
15566 emacs_abort (); 15570 emacs_abort ();
15567 15571
15568 /* If %c is in mode line, update it if needed. */ 15572 if (mode_line_update_needed (w))
15569 if (!NILP (w->column_number_displayed)
15570 /* This alternative quickly identifies a common case
15571 where no change is needed. */
15572 && !(PT == w->last_point && !window_outdated (w))
15573 && (XFASTINT (w->column_number_displayed) != current_column ()))
15574 update_mode_line = 1; 15573 update_mode_line = 1;
15575 15574
15576 /* Count number of windows showing the selected buffer. An indirect 15575 /* Count number of windows showing the selected buffer. An indirect