aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1995-05-09 00:30:26 +0000
committerRichard M. Stallman1995-05-09 00:30:26 +0000
commita2725ab226c2eac9367cef7bd245d447872c0575 (patch)
tree6e21a8c0f5e034e62966435fdeb63ba2cd836ec2 /src
parentd8e54b47e612f215c26ff0d2bacd5f4feb523db9 (diff)
downloademacs-a2725ab226c2eac9367cef7bd245d447872c0575.tar.gz
emacs-a2725ab226c2eac9367cef7bd245d447872c0575.zip
(prepare_menu_bars): Save and restore the match data.
(update_menu_bar): New arg save_match_data. Maybe save and restore match data here.
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 3e25cdd35db..38aa1f060cf 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -153,7 +153,6 @@ static void echo_area_display ();
153void mark_window_display_accurate (); 153void mark_window_display_accurate ();
154static void redisplay_windows (); 154static void redisplay_windows ();
155static void redisplay_window (); 155static void redisplay_window ();
156static void update_menu_bars ();
157static void update_menu_bar (); 156static void update_menu_bar ();
158static void try_window (); 157static void try_window ();
159static int try_window_id (); 158static int try_window_id ();
@@ -667,6 +666,9 @@ prepare_menu_bars ()
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 {
@@ -687,12 +689,14 @@ prepare_menu_bars ()
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
@@ -1181,15 +1185,19 @@ mark_window_display_accurate (window, flag)
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
1186static void 1192static void
1187update_menu_bar (f) 1193update_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
@@ -1218,6 +1226,11 @@ update_menu_bar (f)
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));
@@ -1225,6 +1238,8 @@ update_menu_bar (f)
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}