Mercurial > emacs
comparison src/keyboard.c @ 43428:27bc3e253caf
(menu_bar_items): Don't include keymap or local-map
bindings at PT when building menu (the menu is not updated often
enough for this to work reliable).
(tool_bar_items): Likewise.
(current_active_maps): Removed unused (and faulty) function.
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Wed, 20 Feb 2002 14:51:46 +0000 |
parents | 030bfb08056e |
children | 29dc2ac9c886 |
comparison
equal
deleted
inserted
replaced
43427:43b2b2f46437 | 43428:27bc3e253caf |
---|---|
6494 if (!NILP (Voverriding_local_map)) | 6494 if (!NILP (Voverriding_local_map)) |
6495 maps[nmaps++] = Voverriding_local_map; | 6495 maps[nmaps++] = Voverriding_local_map; |
6496 } | 6496 } |
6497 else | 6497 else |
6498 { | 6498 { |
6499 /* No, so use major and minor mode keymaps and keymap property. */ | 6499 /* No, so use major and minor mode keymaps. |
6500 int extra_maps = 2; | 6500 Don't include local-map or keymap properties, as menu-bar |
6501 Lisp_Object map = get_local_map (PT, current_buffer, Qkeymap); | 6501 bindings are not supported in those maps (that would require |
6502 if (!NILP (map)) | 6502 checking for menu-bar updates after every command). */ |
6503 extra_maps = 3; | |
6504 nmaps = current_minor_maps (NULL, &tmaps); | 6503 nmaps = current_minor_maps (NULL, &tmaps); |
6505 maps = (Lisp_Object *) alloca ((nmaps + extra_maps) | 6504 maps = (Lisp_Object *) alloca ((nmaps + 2) * sizeof (maps[0])); |
6506 * sizeof (maps[0])); | |
6507 bcopy (tmaps, maps, nmaps * sizeof (maps[0])); | 6505 bcopy (tmaps, maps, nmaps * sizeof (maps[0])); |
6508 if (!NILP (map)) | 6506 maps[nmaps++] = current_buffer->keymap; |
6509 maps[nmaps++] = map; | |
6510 maps[nmaps++] = get_local_map (PT, current_buffer, Qlocal_map); | |
6511 } | 6507 } |
6512 maps[nmaps++] = current_global_map; | 6508 maps[nmaps++] = current_global_map; |
6513 } | 6509 } |
6514 | 6510 |
6515 /* Look up in each map the dummy prefix key `menu-bar'. */ | 6511 /* Look up in each map the dummy prefix key `menu-bar'. */ |
7146 if (!NILP (Voverriding_local_map)) | 7142 if (!NILP (Voverriding_local_map)) |
7147 maps[nmaps++] = Voverriding_local_map; | 7143 maps[nmaps++] = Voverriding_local_map; |
7148 } | 7144 } |
7149 else | 7145 else |
7150 { | 7146 { |
7151 /* No, so use major and minor mode keymaps and keymap property. */ | 7147 /* No, so use major and minor mode keymaps. |
7152 int extra_maps = 2; | 7148 Don't include local-map or keymap properties, as tool-bar |
7153 Lisp_Object map = get_local_map (PT, current_buffer, Qkeymap); | 7149 bindings are not supported in those maps (that would require |
7154 if (!NILP (map)) | 7150 checking for tool-bar updates after every command). */ |
7155 extra_maps = 3; | |
7156 nmaps = current_minor_maps (NULL, &tmaps); | 7151 nmaps = current_minor_maps (NULL, &tmaps); |
7157 maps = (Lisp_Object *) alloca ((nmaps + extra_maps) | 7152 maps = (Lisp_Object *) alloca ((nmaps + 2) * sizeof (maps[0])); |
7158 * sizeof (maps[0])); | |
7159 bcopy (tmaps, maps, nmaps * sizeof (maps[0])); | 7153 bcopy (tmaps, maps, nmaps * sizeof (maps[0])); |
7160 if (!NILP (map)) | 7154 maps[nmaps++] = current_buffer->keymap; |
7161 maps[nmaps++] = map; | |
7162 maps[nmaps++] = get_local_map (PT, current_buffer, Qlocal_map); | |
7163 } | 7155 } |
7164 | 7156 |
7165 /* Add global keymap at the end. */ | 7157 /* Add global keymap at the end. */ |
7166 maps[nmaps++] = current_global_map; | 7158 maps[nmaps++] = current_global_map; |
7167 | 7159 |
9477 } | 9469 } |
9478 | 9470 |
9479 RETURN_UNGCPRO (value); | 9471 RETURN_UNGCPRO (value); |
9480 } | 9472 } |
9481 | 9473 |
9482 /* Find the set of keymaps now active. | |
9483 Store into *MAPS_P a vector holding the various maps | |
9484 and return the number of them. The vector was malloc'd | |
9485 and the caller should free it. */ | |
9486 | |
9487 int | |
9488 current_active_maps (maps_p) | |
9489 Lisp_Object **maps_p; | |
9490 { | |
9491 Lisp_Object *tmaps, *maps; | |
9492 int nmaps; | |
9493 | |
9494 /* Should overriding-terminal-local-map and overriding-local-map apply? */ | |
9495 if (!NILP (Voverriding_local_map_menu_flag)) | |
9496 { | |
9497 /* Yes, use them (if non-nil) as well as the global map. */ | |
9498 maps = (Lisp_Object *) xmalloc (3 * sizeof (maps[0])); | |
9499 nmaps = 0; | |
9500 if (!NILP (current_kboard->Voverriding_terminal_local_map)) | |
9501 maps[nmaps++] = current_kboard->Voverriding_terminal_local_map; | |
9502 if (!NILP (Voverriding_local_map)) | |
9503 maps[nmaps++] = Voverriding_local_map; | |
9504 } | |
9505 else | |
9506 { | |
9507 /* No, so use major and minor mode keymaps and keymap property. */ | |
9508 int extra_maps = 2; | |
9509 Lisp_Object map = get_local_map (PT, current_buffer, Qkeymap); | |
9510 if (!NILP (map)) | |
9511 extra_maps = 3; | |
9512 nmaps = current_minor_maps (NULL, &tmaps); | |
9513 maps = (Lisp_Object *) alloca ((nmaps + extra_maps) | |
9514 * sizeof (maps[0])); | |
9515 bcopy (tmaps, maps, nmaps * sizeof (maps[0])); | |
9516 if (!NILP (map)) | |
9517 maps[nmaps++] = map; | |
9518 maps[nmaps++] = get_local_map (PT, current_buffer, Qlocal_map); | |
9519 } | |
9520 maps[nmaps++] = current_global_map; | |
9521 | |
9522 *maps_p = maps; | |
9523 return nmaps; | |
9524 } | |
9525 | 9474 |
9526 /* Return nonzero if input events are pending. */ | 9475 /* Return nonzero if input events are pending. */ |
9527 | 9476 |
9528 int | 9477 int |
9529 detect_input_pending () | 9478 detect_input_pending () |