changeset 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 73334def3609
children 39131193bfc1
files src/xdisp.c
diffstat 1 files changed, 19 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/xdisp.c	Mon Feb 19 13:30:31 2001 +0000
+++ b/src/xdisp.c	Mon Feb 19 13:48:28 2001 +0000
@@ -488,6 +488,11 @@
 
 int message_buf_print;
 
+/* The symbol `inhibit-menubar-update' and its DEFVAR_BOOL variable.  */
+
+Lisp_Object Qinhibit_menubar_update;
+int inhibit_menubar_update;
+
 /* Maximum height for resizing mini-windows.  Either a float
    specifying a fraction of the available height, or an integer
    specifying a number of lines.  */
@@ -6989,6 +6994,12 @@
   Lisp_Object window;
   register struct window *w;
 
+  /* If called recursively during a menu update, do nothing.  This can
+     happen when, for instance, an activate-menubar-hook causes a
+     redisplay.  */
+  if (inhibit_menubar_update)
+    return;
+
   window = FRAME_SELECTED_WINDOW (f);
   w = XWINDOW (window);
   
@@ -7023,6 +7034,8 @@
 	  struct buffer *prev = current_buffer;
 	  int count = BINDING_STACK_SIZE ();
 
+	  specbind (Qinhibit_menubar_update, Qt);
+
 	  set_buffer_internal_1 (XBUFFER (w->buffer));
 	  if (save_match_data)
 	    record_unwind_protect (Fset_match_data, Fmatch_data (Qnil, Qnil));
@@ -14045,6 +14058,8 @@
   staticpro (&Qmessage_truncate_lines);
   Qgrow_only = intern ("grow-only");
   staticpro (&Qgrow_only);
+  Qinhibit_menubar_update = intern ("inhibit-menubar-update");
+  staticpro (&Qinhibit_menubar_update);
 
   last_arrow_position = Qnil;
   last_arrow_string = Qnil;
@@ -14269,6 +14284,10 @@
     "Normal hook run for clicks on menu bar, before displaying a submenu.\n\
 Can be used to update submenus whose contents should vary.");
   Vmenu_bar_update_hook = Qnil;
+  
+  DEFVAR_BOOL ("inhibit-menubar-update", &inhibit_menubar_update,
+    "Non-nil means don't update menu bars.  Internal use only.");
+  inhibit_menubar_update = 0;
 }