emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/xdisp.c,v


From: Richard M. Stallman
Subject: [Emacs-diffs] Changes to emacs/src/xdisp.c,v
Date: Sat, 29 Jul 2006 01:56:35 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Richard M. Stallman <rms>       06/07/29 01:56:35

Index: xdisp.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/xdisp.c,v
retrieving revision 1.1111
retrieving revision 1.1112
diff -u -b -r1.1111 -r1.1112
--- xdisp.c     17 Jul 2006 14:25:05 -0000      1.1111
+++ xdisp.c     29 Jul 2006 01:56:35 -0000      1.1112
@@ -900,7 +900,7 @@
 static Lisp_Object redisplay_window_error ();
 static Lisp_Object redisplay_window_0 P_ ((Lisp_Object));
 static Lisp_Object redisplay_window_1 P_ ((Lisp_Object));
-static void update_menu_bar P_ ((struct frame *, int));
+static int update_menu_bar P_ ((struct frame *, int, int));
 static int try_window_reusing_current_matrix P_ ((struct window *));
 static int try_window_id P_ ((struct window *));
 static int display_line P_ ((struct it *));
@@ -9036,6 +9036,9 @@
     {
       Lisp_Object tail, frame;
       int count = SPECPDL_INDEX ();
+      /* 1 means that update_menu_bar has run its hooks
+        so any further calls to update_menu_bar shouldn't do so again.  */
+      int menu_bar_hooks_run = 0;
 
       record_unwind_save_match_data ();
 
@@ -9067,7 +9070,7 @@
            }
 
          GCPRO1 (tail);
-         update_menu_bar (f, 0);
+         menu_bar_hooks_run = update_menu_bar (f, 0, menu_bar_hooks_run);
 #ifdef HAVE_WINDOW_SYSTEM
          update_tool_bar (f, 0);
 #ifdef MAC_OS
@@ -9082,7 +9085,7 @@
   else
     {
       struct frame *sf = SELECTED_FRAME ();
-      update_menu_bar (sf, 1);
+      update_menu_bar (sf, 1, 0);
 #ifdef HAVE_WINDOW_SYSTEM
       update_tool_bar (sf, 1);
 #ifdef MAC_OS
@@ -9103,12 +9106,18 @@
    before we start to fill in any display lines, because it can call
    eval.
 
-   If SAVE_MATCH_DATA is non-zero, we must save and restore it here.  */
+   If SAVE_MATCH_DATA is non-zero, we must save and restore it here.
 
-static void
-update_menu_bar (f, save_match_data)
+   If HOOKS_RUN is 1, that means a previous call to update_menu_bar
+   already ran the menu bar hooks for this redisplay, so there
+   is no need to run them again.  The return value is the
+   updated value of this flag, to pass to the next call.  */
+
+static int
+update_menu_bar (f, save_match_data, hooks_run)
      struct frame *f;
      int save_match_data;
+     int hooks_run;
 {
   Lisp_Object window;
   register struct window *w;
@@ -9173,6 +9182,8 @@
              specbind (Qoverriding_local_map, Qnil);
            }
 
+         if (!hooks_run)
+           {
          /* Run the Lucid hook.  */
          safe_run_hooks (Qactivate_menubar_hook);
 
@@ -9182,6 +9193,10 @@
            call0 (Qrecompute_lucid_menubar);
 
          safe_run_hooks (Qmenu_bar_update_hook);
+
+             hooks_run = 1;
+           }
+
          FRAME_MENU_BAR_ITEMS (f) = menu_bar_items (FRAME_MENU_BAR_ITEMS (f));
 
          /* Redisplay the menu bar in case we changed it.  */
@@ -9210,6 +9225,8 @@
          set_buffer_internal_1 (prev);
        }
     }
+
+  return hooks_run;
 }
 
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]