comparison src/xdisp.c @ 36194:be25f9e946fb

(Qinhibit_menubar_update, inhibit_menubar_update): New variables. (syms_of_xdisp): Initialize new variables. (update_menu_bar): Do nothing if inhibit_menubar_update is set. Specbind `inhibit-menubar-update' when updating the menu bar.
author Gerd Moellmann <gerd@gnu.org>
date Mon, 19 Feb 2001 13:48:28 +0000
parents e3f902bbc767
children 32505f3d0441
comparison
equal deleted inserted replaced
36193:73334def3609 36194:be25f9e946fb
485 485
486 /* Nonzero if echo area is being used by print; zero if being used by 486 /* Nonzero if echo area is being used by print; zero if being used by
487 message. */ 487 message. */
488 488
489 int message_buf_print; 489 int message_buf_print;
490
491 /* The symbol `inhibit-menubar-update' and its DEFVAR_BOOL variable. */
492
493 Lisp_Object Qinhibit_menubar_update;
494 int inhibit_menubar_update;
490 495
491 /* Maximum height for resizing mini-windows. Either a float 496 /* Maximum height for resizing mini-windows. Either a float
492 specifying a fraction of the available height, or an integer 497 specifying a fraction of the available height, or an integer
493 specifying a number of lines. */ 498 specifying a number of lines. */
494 499
6987 int save_match_data; 6992 int save_match_data;
6988 { 6993 {
6989 Lisp_Object window; 6994 Lisp_Object window;
6990 register struct window *w; 6995 register struct window *w;
6991 6996
6997 /* If called recursively during a menu update, do nothing. This can
6998 happen when, for instance, an activate-menubar-hook causes a
6999 redisplay. */
7000 if (inhibit_menubar_update)
7001 return;
7002
6992 window = FRAME_SELECTED_WINDOW (f); 7003 window = FRAME_SELECTED_WINDOW (f);
6993 w = XWINDOW (window); 7004 w = XWINDOW (window);
6994 7005
6995 if (update_mode_lines) 7006 if (update_mode_lines)
6996 w->update_mode_line = Qt; 7007 w->update_mode_line = Qt;
7020 && !NILP (XBUFFER (w->buffer)->mark_active)) 7031 && !NILP (XBUFFER (w->buffer)->mark_active))
7021 != !NILP (w->region_showing))) 7032 != !NILP (w->region_showing)))
7022 { 7033 {
7023 struct buffer *prev = current_buffer; 7034 struct buffer *prev = current_buffer;
7024 int count = BINDING_STACK_SIZE (); 7035 int count = BINDING_STACK_SIZE ();
7036
7037 specbind (Qinhibit_menubar_update, Qt);
7025 7038
7026 set_buffer_internal_1 (XBUFFER (w->buffer)); 7039 set_buffer_internal_1 (XBUFFER (w->buffer));
7027 if (save_match_data) 7040 if (save_match_data)
7028 record_unwind_protect (Fset_match_data, Fmatch_data (Qnil, Qnil)); 7041 record_unwind_protect (Fset_match_data, Fmatch_data (Qnil, Qnil));
7029 if (NILP (Voverriding_local_map_menu_flag)) 7042 if (NILP (Voverriding_local_map_menu_flag))
14043 staticpro (&Qimage); 14056 staticpro (&Qimage);
14044 Qmessage_truncate_lines = intern ("message-truncate-lines"); 14057 Qmessage_truncate_lines = intern ("message-truncate-lines");
14045 staticpro (&Qmessage_truncate_lines); 14058 staticpro (&Qmessage_truncate_lines);
14046 Qgrow_only = intern ("grow-only"); 14059 Qgrow_only = intern ("grow-only");
14047 staticpro (&Qgrow_only); 14060 staticpro (&Qgrow_only);
14061 Qinhibit_menubar_update = intern ("inhibit-menubar-update");
14062 staticpro (&Qinhibit_menubar_update);
14048 14063
14049 last_arrow_position = Qnil; 14064 last_arrow_position = Qnil;
14050 last_arrow_string = Qnil; 14065 last_arrow_string = Qnil;
14051 staticpro (&last_arrow_position); 14066 staticpro (&last_arrow_position);
14052 staticpro (&last_arrow_string); 14067 staticpro (&last_arrow_string);
14267 14282
14268 DEFVAR_LISP ("menu-bar-update-hook", &Vmenu_bar_update_hook, 14283 DEFVAR_LISP ("menu-bar-update-hook", &Vmenu_bar_update_hook,
14269 "Normal hook run for clicks on menu bar, before displaying a submenu.\n\ 14284 "Normal hook run for clicks on menu bar, before displaying a submenu.\n\
14270 Can be used to update submenus whose contents should vary."); 14285 Can be used to update submenus whose contents should vary.");
14271 Vmenu_bar_update_hook = Qnil; 14286 Vmenu_bar_update_hook = Qnil;
14287
14288 DEFVAR_BOOL ("inhibit-menubar-update", &inhibit_menubar_update,
14289 "Non-nil means don't update menu bars. Internal use only.");
14290 inhibit_menubar_update = 0;
14272 } 14291 }
14273 14292
14274 14293
14275 /* Initialize this module when Emacs starts. */ 14294 /* Initialize this module when Emacs starts. */
14276 14295