aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier2008-04-04 17:31:20 +0000
committerStefan Monnier2008-04-04 17:31:20 +0000
commit00f7c5edc6a0703d84f4a37f273c31364e6ce0fc (patch)
tree6b49abd4cff1d6871cde0356e51e196473a29ae1 /src
parent4591d6cbefecb9b967c87be2997e55a9c073a207 (diff)
downloademacs-00f7c5edc6a0703d84f4a37f273c31364e6ce0fc.tar.gz
emacs-00f7c5edc6a0703d84f4a37f273c31364e6ce0fc.zip
* subr.el (keymap-canonicalize): New function.
* mouse.el (mouse-menu-non-singleton): Use it. (mouse-major-mode-menu): Remove hack made unnecessary. * keymap.c (Qkeymap_canonicalize): New var. (Fmap_keymap_internal): New fun. (describe_map): Use keymap-canonicalize.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog4
-rw-r--r--src/keymap.c29
2 files changed, 31 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 1fdeca7ed57..e8cc705a23c 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,9 @@
12008-04-04 Stefan Monnier <monnier@iro.umontreal.ca> 12008-04-04 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * keymap.c (Qkeymap_canonicalize): New var.
4 (Fmap_keymap_internal): New fun.
5 (describe_map): Use keymap-canonicalize.
6
3 * undo.c (last_boundary_buffer, last_boundary_position): New vars. 7 * undo.c (last_boundary_buffer, last_boundary_position): New vars.
4 (Fundo_boundary): Set them. 8 (Fundo_boundary): Set them.
5 (syms_of_undo): Initialize them. 9 (syms_of_undo): Initialize them.
diff --git a/src/keymap.c b/src/keymap.c
index 9ed1e92c84b..94d2ab5fe67 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -731,6 +731,26 @@ map_keymap (map, fun, args, data, autoload)
731 UNGCPRO; 731 UNGCPRO;
732} 732}
733 733
734Lisp_Object Qkeymap_canonicalize;
735
736/* Same as map_keymap, but does it right, properly eliminating duplicate
737 bindings due to inheritance. */
738void
739map_keymap_canonical (map, fun, args, data)
740 map_keymap_function_t fun;
741 Lisp_Object map, args;
742 void *data;
743{
744 struct gcpro gcpro1;
745 GCPRO1 (args);
746 /* map_keymap_canonical may be used from redisplay (e.g. when building menus)
747 so be careful to ignore errors and to inhibit redisplay. */
748 map = safe_call1 (Qkeymap_canonicalize, map);
749 /* No need to use `map_keymap' here because canonical map has no parent. */
750 map_keymap_internal (map, fun, args, data);
751 UNGCPRO;
752}
753
734DEFUN ("map-keymap-internal", Fmap_keymap_internal, Smap_keymap_internal, 2, 2, 0, 754DEFUN ("map-keymap-internal", Fmap_keymap_internal, Smap_keymap_internal, 2, 2, 0,
735 doc: /* Call FUNCTION once for each event binding in KEYMAP. 755 doc: /* Call FUNCTION once for each event binding in KEYMAP.
736FUNCTION is called with two arguments: the event that is bound, and 756FUNCTION is called with two arguments: the event that is bound, and
@@ -3407,14 +3427,16 @@ describe_map (map, prefix, elt_describer, partial, shadow,
3407 kludge = Fmake_vector (make_number (1), Qnil); 3427 kludge = Fmake_vector (make_number (1), Qnil);
3408 definition = Qnil; 3428 definition = Qnil;
3409 3429
3430 GCPRO3 (prefix, definition, kludge);
3431
3432 map = call1 (Qkeymap_canonicalize, map);
3433
3410 for (tail = map; CONSP (tail); tail = XCDR (tail)) 3434 for (tail = map; CONSP (tail); tail = XCDR (tail))
3411 length_needed++; 3435 length_needed++;
3412 3436
3413 vect = ((struct describe_map_elt *) 3437 vect = ((struct describe_map_elt *)
3414 alloca (sizeof (struct describe_map_elt) * length_needed)); 3438 alloca (sizeof (struct describe_map_elt) * length_needed));
3415 3439
3416 GCPRO3 (prefix, definition, kludge);
3417
3418 for (tail = map; CONSP (tail); tail = XCDR (tail)) 3440 for (tail = map; CONSP (tail); tail = XCDR (tail))
3419 { 3441 {
3420 QUIT; 3442 QUIT;
@@ -3850,6 +3872,9 @@ syms_of_keymap ()
3850 apropos_predicate = Qnil; 3872 apropos_predicate = Qnil;
3851 apropos_accumulate = Qnil; 3873 apropos_accumulate = Qnil;
3852 3874
3875 Qkeymap_canonicalize = intern ("keymap-canonicalize");
3876 staticpro (&Qkeymap_canonicalize);
3877
3853 /* Now we are ready to set up this property, so we can 3878 /* Now we are ready to set up this property, so we can
3854 create char tables. */ 3879 create char tables. */
3855 Fput (Qkeymap, Qchar_table_extra_slots, make_number (0)); 3880 Fput (Qkeymap, Qchar_table_extra_slots, make_number (0));