emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/src/xmenu.c [emacs-unicode-2]


From: Miles Bader
Subject: [Emacs-diffs] Changes to emacs/src/xmenu.c [emacs-unicode-2]
Date: Sat, 04 Sep 2004 05:39:24 -0400

Index: emacs/src/xmenu.c
diff -c emacs/src/xmenu.c:1.249.2.2 emacs/src/xmenu.c:1.249.2.3
*** emacs/src/xmenu.c:1.249.2.2 Fri Apr 16 12:51:04 2004
--- emacs/src/xmenu.c   Sat Sep  4 09:14:28 2004
***************
*** 1701,1712 ****
                save_wv->next = wv;
              else
                first_wv->contents = wv;
!             wv->name = pane_string;
!             /* Ignore the @ that means "separate pane".
!                This is a kludge, but this isn't worth more time.  */
!             if (!NILP (prefix) && wv->name[0] == '@')
!               wv->name++;
!             wv->value = 0;
              wv->enabled = 1;
              wv->button_type = BUTTON_TYPE_NONE;
              wv->help = Qnil;
--- 1701,1709 ----
                save_wv->next = wv;
              else
                first_wv->contents = wv;
!             wv->lname = pane_name;
!               /* Set value to 1 so update_submenu_strings can handle '@'  */
!             wv->value = (char *)1;
              wv->enabled = 1;
              wv->button_type = BUTTON_TYPE_NONE;
              wv->help = Qnil;
***************
*** 1749,1757 ****
          else
            save_wv->contents = wv;
  
!         wv->name = (char *) SDATA (item_name);
          if (!NILP (descrip))
!           wv->key = (char *) SDATA (descrip);
          wv->value = 0;
          /* The EMACS_INT cast avoids a warning.  There's no problem
             as long as pointers have enough bits to hold small integers.  */
--- 1746,1754 ----
          else
            save_wv->contents = wv;
  
!         wv->lname = item_name;
          if (!NILP (descrip))
!           wv->lkey = descrip;
          wv->value = 0;
          /* The EMACS_INT cast avoids a warning.  There's no problem
             as long as pointers have enough bits to hold small integers.  */
***************
*** 1790,1795 ****
--- 1787,1828 ----
  
    return first_wv;
  }
+ 
+ /* Walk through the widget_value tree starting at FIRST_WV and update
+    the char * pointers from the corresponding lisp values.
+    We do this after building the whole tree, since GC may happen while the
+    tree is constructed, and small strings are relocated.  So we must wait
+    until no GC can happen before storing pointers into lisp values.  */
+ static void
+ update_submenu_strings (first_wv)
+      widget_value *first_wv;
+ {
+   widget_value *wv;
+ 
+   for (wv = first_wv; wv; wv = wv->next)
+     {
+       if (wv->lname && ! NILP (wv->lname))
+         {
+           wv->name = SDATA (wv->lname);
+ 
+           /* Ignore the @ that means "separate pane".
+              This is a kludge, but this isn't worth more time.  */
+           if (wv->value == (char *)1)
+             {
+               if (wv->name[0] == '@')
+               wv->name++;
+               wv->value = 0;
+             }
+         }
+ 
+       if (wv->lkey && ! NILP (wv->lkey))
+         wv->key = SDATA (wv->lkey);
+ 
+       if (wv->contents)
+         update_submenu_strings (wv->contents);
+     }
+ }
+ 
  
  /* Recompute all the widgets of frame F, when the menu bar has been
     changed.  Value is non-zero if widgets were updated.  */
***************
*** 2022,2030 ****
          Lisp_Object string;
          string = XVECTOR (items)->contents[i + 1];
          if (NILP (string))
!           break;
!         wv->name = (char *) SDATA (string);
!         wv = wv->next;
        }
  
        f->menu_bar_vector = menu_items;
--- 2055,2064 ----
          Lisp_Object string;
          string = XVECTOR (items)->contents[i + 1];
          if (NILP (string))
!             break;
!           wv->name = (char *) SDATA (string);
!           update_submenu_strings (wv->contents);
!           wv = wv->next;
        }
  
        f->menu_bar_vector = menu_items;




reply via email to

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