]> git.eshelyaron.com Git - emacs.git/commitdiff
(menu_bar_items): Mostly undo 2002-02-20 patch, so
authorKim F. Storm <storm@cua.dk>
Thu, 21 Mar 2002 21:33:31 +0000 (21:33 +0000)
committerKim F. Storm <storm@cua.dk>
Thu, 21 Mar 2002 21:33:31 +0000 (21:33 +0000)
menu-bar bindings in keymap and local-map properties _are_ used.
But try keymap property first in accordance with 2002-01-03 patch.
Added comment describing why this is not always reliable.
(tool_bar_items): Ditto for tool-bar.

src/ChangeLog
src/keyboard.c

index 56d5076d0218a10f3c76bf1f26789378a5b29397..868fc5a14f772bbe95d56a9c8cbbdb38f43c3ef2 100644 (file)
@@ -1,3 +1,11 @@
+2002-03-21  Kim F. Storm  <storm@cua.dk>
+
+       * keyboard.c (menu_bar_items): Mostly undo 2002-02-20 patch, so
+       menu-bar bindings in keymap and local-map properties _are_ used.
+       But try keymap property first in accordance with 2002-01-03 patch.
+       Added comment describing why this is not always reliable.
+       (tool_bar_items): Ditto for tool-bar.
+
 2002-03-21  Jason Rumney  <jasonr@gnu.org>
 
        * w32fns.c (x_clear_image_1): Disable color table code.
index d04580b7c5a4c98eab5bdb7d0aaed23bbbf568b7..7862796f8fb64185a9561bd516561625f65cc40f 100644 (file)
@@ -6510,14 +6510,21 @@ menu_bar_items (old)
       }
     else
       {
-       /* No, so use major and minor mode keymaps.
-          Don't include local-map or keymap properties, as menu-bar
-          bindings are not supported in those maps (that would require
-          checking for menu-bar updates after every command).  */
-       nmaps = current_minor_maps (NULL, &tmaps);
-       maps = (Lisp_Object *) alloca ((nmaps + 2) * sizeof (maps[0]));
-       bcopy (tmaps, maps, nmaps * sizeof (maps[0]));
-       maps[nmaps++] = current_buffer->keymap;
+       /* No, so use major and minor mode keymaps and keymap property.
+          Note that menu-bar bindings in the local-map and keymap
+          properties may not work reliable, as they are only
+          recognized when the menu-bar (or mode-line) is updated,
+          which does not normally happen after every command.  */
+       Lisp_Object tem;
+       int nminor;
+       nminor = current_minor_maps (NULL, &tmaps);
+       maps = (Lisp_Object *) alloca ((nminor + 3) * sizeof (maps[0]));
+       nmaps = 0;
+       if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem))
+         maps[nmaps++] = tem;
+       bcopy (tmaps, (void *) (maps + nmaps), nminor * sizeof (maps[0]));
+       nmaps += nminor;
+       maps[nmaps++] = get_local_map (PT, current_buffer, Qlocal_map);
       }
     maps[nmaps++] = current_global_map;
   }
@@ -7158,14 +7165,21 @@ tool_bar_items (reuse, nitems)
     }
   else
     {
-      /* No, so use major and minor mode keymaps.
-        Don't include local-map or keymap properties, as tool-bar
-        bindings are not supported in those maps (that would require
-        checking for tool-bar updates after every command).  */
-      nmaps = current_minor_maps (NULL, &tmaps);
-      maps = (Lisp_Object *) alloca ((nmaps + 2) * sizeof (maps[0]));
-      bcopy (tmaps, maps, nmaps * sizeof (maps[0]));
-      maps[nmaps++] = current_buffer->keymap;
+      /* No, so use major and minor mode keymaps and keymap property.
+        Note that tool-bar bindings in the local-map and keymap
+        properties may not work reliable, as they are only
+        recognized when the tool-bar (or mode-line) is updated,
+        which does not normally happen after every command.  */
+      Lisp_Object tem;
+      int nminor;
+      nminor = current_minor_maps (NULL, &tmaps);
+      maps = (Lisp_Object *) alloca ((nminor + 3) * sizeof (maps[0]));
+      nmaps = 0;
+      if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem))
+       maps[nmaps++] = tem;
+      bcopy (tmaps, (void *) (maps + nmaps), nminor * sizeof (maps[0]));
+      nmaps += nminor;
+      maps[nmaps++] = get_local_map (PT, current_buffer, Qlocal_map);
     }
 
   /* Add global keymap at the end.  */