comparison src/xdisp.c @ 11761:d110042c1d95

(prepare_menu_bars): Save and restore the match data. (update_menu_bar): New arg save_match_data. Maybe save and restore match data here.
author Richard M. Stallman <rms@gnu.org>
date Tue, 09 May 1995 00:30:26 +0000
parents 9238e21a6f09
children 4166c8ea623d
comparison
equal deleted inserted replaced
11760:898ec89f5379 11761:d110042c1d95
151 static int message_log_check_duplicate (); 151 static int message_log_check_duplicate ();
152 static void echo_area_display (); 152 static void echo_area_display ();
153 void mark_window_display_accurate (); 153 void mark_window_display_accurate ();
154 static void redisplay_windows (); 154 static void redisplay_windows ();
155 static void redisplay_window (); 155 static void redisplay_window ();
156 static void update_menu_bars ();
157 static void update_menu_bar (); 156 static void update_menu_bar ();
158 static void try_window (); 157 static void try_window ();
159 static int try_window_id (); 158 static int try_window_id ();
160 static struct position *display_text_line (); 159 static struct position *display_text_line ();
161 static void display_mode_line (); 160 static void display_mode_line ();
665 This has to be done before any actual redisplay 664 This has to be done before any actual redisplay
666 or generation of display lines. */ 665 or generation of display lines. */
667 if (all_windows) 666 if (all_windows)
668 { 667 {
669 Lisp_Object tail, frame; 668 Lisp_Object tail, frame;
669 int count = specpdl_ptr - specpdl;
670
671 record_unwind_protect (Fstore_match_data, Fmatch_data ());
670 672
671 FOR_EACH_FRAME (tail, frame) 673 FOR_EACH_FRAME (tail, frame)
672 { 674 {
673 /* If a window on this frame changed size, 675 /* If a window on this frame changed size,
674 report that to the user and clear the size-change flag. */ 676 report that to the user and clear the size-change flag. */
685 functions = XCONS (functions)->cdr; 687 functions = XCONS (functions)->cdr;
686 } 688 }
687 UNGCPRO; 689 UNGCPRO;
688 } 690 }
689 GCPRO1 (tail); 691 GCPRO1 (tail);
690 update_menu_bar (XFRAME (frame)); 692 update_menu_bar (XFRAME (frame), 0);
691 UNGCPRO; 693 UNGCPRO;
692 } 694 }
695
696 unbind_to (count, Qnil);
693 } 697 }
694 else 698 else
695 update_menu_bar (selected_frame); 699 update_menu_bar (selected_frame, 1);
696 700
697 /* Update all frame titles based on their buffer names, etc. 701 /* Update all frame titles based on their buffer names, etc.
698 We do this after the menu bars so that the frame will first 702 We do this after the menu bars so that the frame will first
699 create its menu bar using the name `emacs' if no other name 703 create its menu bar using the name `emacs' if no other name
700 has yet been specified. */ 704 has yet been specified. */
1179 } 1183 }
1180 } 1184 }
1181 1185
1182 /* Update the menu bar item list for frame F. 1186 /* Update the menu bar item list for frame F.
1183 This has to be done before we start to fill in any display lines, 1187 This has to be done before we start to fill in any display lines,
1184 because it can call eval. */ 1188 because it can call eval.
1189
1190 If SAVE_MATCH_DATA is 1, we must save and restore it here. */
1185 1191
1186 static void 1192 static void
1187 update_menu_bar (f) 1193 update_menu_bar (f, save_match_data)
1188 FRAME_PTR f; 1194 FRAME_PTR f;
1195 int save_match_data;
1189 { 1196 {
1190 struct buffer *old = current_buffer; 1197 struct buffer *old = current_buffer;
1191 Lisp_Object window; 1198 Lisp_Object window;
1192 register struct window *w; 1199 register struct window *w;
1200
1193 window = FRAME_SELECTED_WINDOW (f); 1201 window = FRAME_SELECTED_WINDOW (f);
1194 w = XWINDOW (window); 1202 w = XWINDOW (window);
1195 1203
1196 if (update_mode_lines) 1204 if (update_mode_lines)
1197 w->update_mode_line = Qt; 1205 w->update_mode_line = Qt;
1216 || (XFASTINT (w->last_modified) < MODIFF 1224 || (XFASTINT (w->last_modified) < MODIFF
1217 && (XFASTINT (w->last_modified) 1225 && (XFASTINT (w->last_modified)
1218 <= BUF_SAVE_MODIFF (XBUFFER (w->buffer))))) 1226 <= BUF_SAVE_MODIFF (XBUFFER (w->buffer)))))
1219 { 1227 {
1220 struct buffer *prev = current_buffer; 1228 struct buffer *prev = current_buffer;
1229 int count = specpdl_ptr - specpdl;
1230
1231 if (!save_match_data)
1232 record_unwind_protect (Fstore_match_data, Fmatch_data ());
1233
1221 call1 (Vrun_hooks, Qmenu_bar_update_hook); 1234 call1 (Vrun_hooks, Qmenu_bar_update_hook);
1222 current_buffer = XBUFFER (w->buffer); 1235 current_buffer = XBUFFER (w->buffer);
1223 FRAME_MENU_BAR_ITEMS (f) = menu_bar_items (FRAME_MENU_BAR_ITEMS (f)); 1236 FRAME_MENU_BAR_ITEMS (f) = menu_bar_items (FRAME_MENU_BAR_ITEMS (f));
1224 current_buffer = prev; 1237 current_buffer = prev;
1225 #ifdef USE_X_TOOLKIT 1238 #ifdef USE_X_TOOLKIT
1226 set_frame_menubar (f, 0); 1239 set_frame_menubar (f, 0);
1227 #endif /* USE_X_TOOLKIT */ 1240 #endif /* USE_X_TOOLKIT */
1241
1242 unbind_to (count, Qnil);
1228 } 1243 }
1229 } 1244 }
1230 } 1245 }
1231 1246
1232 int do_id = 1; 1247 int do_id = 1;