aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDmitry Antipov2012-11-22 10:52:30 +0400
committerDmitry Antipov2012-11-22 10:52:30 +0400
commit6ceeb5f14411ed388979d0bb944c06e36756f9af (patch)
treeac64624f4164404b72aaae27ca83687f135d1d2c /src
parentec84768f9754d5943610cbbd048dc4d4a46d847f (diff)
downloademacs-6ceeb5f14411ed388979d0bb944c06e36756f9af.tar.gz
emacs-6ceeb5f14411ed388979d0bb944c06e36756f9af.zip
* xdisp.c (window_buffer_changed): New function.
(update_menu_bar, update_tool_bar): Use it to simplify large 'if' statements. (redisplay_internal): Generalize commonly used 'tail' and 'frame' local variables.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog8
-rw-r--r--src/xdisp.c74
2 files changed, 40 insertions, 42 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 3587a9e295b..4a4572bdd63 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
12012-11-22 Dmitry Antipov <dmantipov@yandex.ru>
2
3 * xdisp.c (window_buffer_changed): New function.
4 (update_menu_bar, update_tool_bar): Use it to
5 simplify large 'if' statements.
6 (redisplay_internal): Generalize commonly used
7 'tail' and 'frame' local variables.
8
12012-11-22 Eli Zaretskii <eliz@gnu.org> 92012-11-22 Eli Zaretskii <eliz@gnu.org>
2 10
3 * w32.c (getcwd): Fix the 2nd argument type, to prevent conflicts 11 * w32.c (getcwd): Fix the 2nd argument type, to prevent conflicts
diff --git a/src/xdisp.c b/src/xdisp.c
index f0da28fcedd..e9b20d148c7 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -10908,6 +10908,21 @@ window_outdated (struct window *w)
10908 || w->last_overlay_modified < OVERLAY_MODIFF); 10908 || w->last_overlay_modified < OVERLAY_MODIFF);
10909} 10909}
10910 10910
10911/* Nonzero if W's buffer was changed but not saved or Transient Mark mode
10912 is enabled and mark of W's buffer was changed since last W's update. */
10913
10914static int
10915window_buffer_changed (struct window *w)
10916{
10917 struct buffer *b = XBUFFER (w->buffer);
10918
10919 eassert (BUFFER_LIVE_P (b));
10920
10921 return (((BUF_SAVE_MODIFF (b) < BUF_MODIFF (b)) != w->last_had_star)
10922 || ((!NILP (Vtransient_mark_mode) && !NILP (BVAR (b, mark_active)))
10923 != !NILP (w->region_showing)));
10924}
10925
10911/*********************************************************************** 10926/***********************************************************************
10912 Mode Lines and Frame Titles 10927 Mode Lines and Frame Titles
10913 ***********************************************************************/ 10928 ***********************************************************************/
@@ -11327,12 +11342,7 @@ update_menu_bar (struct frame *f, int save_match_data, int hooks_run)
11327 /* This used to test w->update_mode_line, but we believe 11342 /* This used to test w->update_mode_line, but we believe
11328 there is no need to recompute the menu in that case. */ 11343 there is no need to recompute the menu in that case. */
11329 || update_mode_lines 11344 || update_mode_lines
11330 || ((BUF_SAVE_MODIFF (XBUFFER (w->buffer)) 11345 || window_buffer_changed (w))
11331 < BUF_MODIFF (XBUFFER (w->buffer)))
11332 != w->last_had_star)
11333 || ((!NILP (Vtransient_mark_mode)
11334 && !NILP (BVAR (XBUFFER (w->buffer), mark_active)))
11335 != !NILP (w->region_showing)))
11336 { 11346 {
11337 struct buffer *prev = current_buffer; 11347 struct buffer *prev = current_buffer;
11338 ptrdiff_t count = SPECPDL_INDEX (); 11348 ptrdiff_t count = SPECPDL_INDEX ();
@@ -11532,12 +11542,7 @@ update_tool_bar (struct frame *f, int save_match_data)
11532 if (windows_or_buffers_changed 11542 if (windows_or_buffers_changed
11533 || w->update_mode_line 11543 || w->update_mode_line
11534 || update_mode_lines 11544 || update_mode_lines
11535 || ((BUF_SAVE_MODIFF (XBUFFER (w->buffer)) 11545 || window_buffer_changed (w))
11536 < BUF_MODIFF (XBUFFER (w->buffer)))
11537 != w->last_had_star)
11538 || ((!NILP (Vtransient_mark_mode)
11539 && !NILP (BVAR (XBUFFER (w->buffer), mark_active)))
11540 != !NILP (w->region_showing)))
11541 { 11546 {
11542 struct buffer *prev = current_buffer; 11547 struct buffer *prev = current_buffer;
11543 ptrdiff_t count = SPECPDL_INDEX (); 11548 ptrdiff_t count = SPECPDL_INDEX ();
@@ -12988,7 +12993,7 @@ redisplay_internal (void)
12988 ptrdiff_t count, count1; 12993 ptrdiff_t count, count1;
12989 struct frame *sf; 12994 struct frame *sf;
12990 int polling_stopped_here = 0; 12995 int polling_stopped_here = 0;
12991 Lisp_Object old_frame = selected_frame; 12996 Lisp_Object tail, frame, old_frame = selected_frame;
12992 struct backtrace backtrace; 12997 struct backtrace backtrace;
12993 12998
12994 /* Non-zero means redisplay has to consider all windows on all 12999 /* Non-zero means redisplay has to consider all windows on all
@@ -13040,15 +13045,8 @@ redisplay_internal (void)
13040 backtrace.debug_on_exit = 0; 13045 backtrace.debug_on_exit = 0;
13041 backtrace_list = &backtrace; 13046 backtrace_list = &backtrace;
13042 13047
13043 { 13048 FOR_EACH_FRAME (tail, frame)
13044 Lisp_Object tail, frame; 13049 XFRAME (frame)->already_hscrolled_p = 0;
13045
13046 FOR_EACH_FRAME (tail, frame)
13047 {
13048 struct frame *f = XFRAME (frame);
13049 f->already_hscrolled_p = 0;
13050 }
13051 }
13052 13050
13053 retry: 13051 retry:
13054 /* Remember the currently selected window. */ 13052 /* Remember the currently selected window. */
@@ -13098,25 +13096,20 @@ redisplay_internal (void)
13098 FRAME_TTY (sf)->previous_frame = sf; 13096 FRAME_TTY (sf)->previous_frame = sf;
13099 } 13097 }
13100 13098
13101 /* Set the visible flags for all frames. Do this before checking 13099 /* Set the visible flags for all frames. Do this before checking for
13102 for resized or garbaged frames; they want to know if their frames 13100 resized or garbaged frames; they want to know if their frames are
13103 are visible. See the comment in frame.h for 13101 visible. See the comment in frame.h for FRAME_SAMPLE_VISIBILITY. */
13104 FRAME_SAMPLE_VISIBILITY. */ 13102 number_of_visible_frames = 0;
13105 {
13106 Lisp_Object tail, frame;
13107
13108 number_of_visible_frames = 0;
13109 13103
13110 FOR_EACH_FRAME (tail, frame) 13104 FOR_EACH_FRAME (tail, frame)
13111 { 13105 {
13112 struct frame *f = XFRAME (frame); 13106 struct frame *f = XFRAME (frame);
13113 13107
13114 FRAME_SAMPLE_VISIBILITY (f); 13108 FRAME_SAMPLE_VISIBILITY (f);
13115 if (FRAME_VISIBLE_P (f)) 13109 if (FRAME_VISIBLE_P (f))
13116 ++number_of_visible_frames; 13110 ++number_of_visible_frames;
13117 clear_desired_matrices (f); 13111 clear_desired_matrices (f);
13118 } 13112 }
13119 }
13120 13113
13121 /* Notice any pending interrupt request to change frame size. */ 13114 /* Notice any pending interrupt request to change frame size. */
13122 do_pending_window_change (1); 13115 do_pending_window_change (1);
@@ -13467,8 +13460,6 @@ redisplay_internal (void)
13467 13460
13468 if (consider_all_windows_p) 13461 if (consider_all_windows_p)
13469 { 13462 {
13470 Lisp_Object tail, frame;
13471
13472 FOR_EACH_FRAME (tail, frame) 13463 FOR_EACH_FRAME (tail, frame)
13473 XFRAME (frame)->updated_p = 0; 13464 XFRAME (frame)->updated_p = 0;
13474 13465
@@ -13678,7 +13669,6 @@ redisplay_internal (void)
13678 frames here explicitly. */ 13669 frames here explicitly. */
13679 if (!pending) 13670 if (!pending)
13680 { 13671 {
13681 Lisp_Object tail, frame;
13682 int new_count = 0; 13672 int new_count = 0;
13683 13673
13684 FOR_EACH_FRAME (tail, frame) 13674 FOR_EACH_FRAME (tail, frame)