diff options
| author | Stefan Monnier | 2013-06-04 21:58:43 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2013-06-04 21:58:43 -0400 |
| commit | bfa3acd65ba6e8cbaf66a4f3f61810ffba7b3fad (patch) | |
| tree | 230455c7f248de71d969ec07de0760dfa77f91d7 /src | |
| parent | 2587b005f0f11913c2158fe8c81b18ebfc0beca8 (diff) | |
| download | emacs-bfa3acd65ba6e8cbaf66a4f3f61810ffba7b3fad.tar.gz emacs-bfa3acd65ba6e8cbaf66a4f3f61810ffba7b3fad.zip | |
* src/keymap.c (Fcurrent_active_maps, Fdescribe_buffer_bindings):
* src/keyboard.c (menu_bar_items, tool_bar_items):
* src/doc.c (Fsubstitute_command_keys): Voverriding_terminal_local_map does
not override local keymaps any more.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/doc.c | 4 | ||||
| -rw-r--r-- | src/keyboard.c | 23 | ||||
| -rw-r--r-- | src/keymap.c | 45 |
4 files changed, 49 insertions, 30 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 0914d8efac0..bfb9b1a4c83 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2013-06-05 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * keymap.c (Fcurrent_active_maps, Fdescribe_buffer_bindings): | ||
| 4 | * keyboard.c (menu_bar_items, tool_bar_items): | ||
| 5 | * doc.c (Fsubstitute_command_keys): Voverriding_terminal_local_map does | ||
| 6 | not override local keymaps any more. | ||
| 7 | |||
| 1 | 2013-06-04 Eli Zaretskii <eliz@gnu.org> | 8 | 2013-06-04 Eli Zaretskii <eliz@gnu.org> |
| 2 | 9 | ||
| 3 | * window.c (Fpos_visible_in_window_p): Doc fix. (Bug#14540) | 10 | * window.c (Fpos_visible_in_window_p): Doc fix. (Bug#14540) |
| @@ -758,9 +758,7 @@ Otherwise, return a new string, without any text properties. */) | |||
| 758 | or a specified local map (which means search just that and the | 758 | or a specified local map (which means search just that and the |
| 759 | global map). If non-nil, it might come from Voverriding_local_map, | 759 | global map). If non-nil, it might come from Voverriding_local_map, |
| 760 | or from a \\<mapname> construct in STRING itself.. */ | 760 | or from a \\<mapname> construct in STRING itself.. */ |
| 761 | keymap = KVAR (current_kboard, Voverriding_terminal_local_map); | 761 | keymap = Voverriding_local_map; |
| 762 | if (NILP (keymap)) | ||
| 763 | keymap = Voverriding_local_map; | ||
| 764 | 762 | ||
| 765 | bsize = SBYTES (string); | 763 | bsize = SBYTES (string); |
| 766 | bufp = buf = xmalloc (bsize); | 764 | bufp = buf = xmalloc (bsize); |
diff --git a/src/keyboard.c b/src/keyboard.c index 8dd109d252d..d01ecb9432b 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -7392,7 +7392,8 @@ menu_bar_items (Lisp_Object old) | |||
| 7392 | Lisp_Object *tmaps; | 7392 | Lisp_Object *tmaps; |
| 7393 | 7393 | ||
| 7394 | /* Should overriding-terminal-local-map and overriding-local-map apply? */ | 7394 | /* Should overriding-terminal-local-map and overriding-local-map apply? */ |
| 7395 | if (!NILP (Voverriding_local_map_menu_flag)) | 7395 | if (!NILP (Voverriding_local_map_menu_flag) |
| 7396 | && !NILP (Voverriding_local_map)) | ||
| 7396 | { | 7397 | { |
| 7397 | /* Yes, use them (if non-nil) as well as the global map. */ | 7398 | /* Yes, use them (if non-nil) as well as the global map. */ |
| 7398 | maps = alloca (3 * sizeof (maps[0])); | 7399 | maps = alloca (3 * sizeof (maps[0])); |
| @@ -7412,8 +7413,11 @@ menu_bar_items (Lisp_Object old) | |||
| 7412 | Lisp_Object tem; | 7413 | Lisp_Object tem; |
| 7413 | ptrdiff_t nminor; | 7414 | ptrdiff_t nminor; |
| 7414 | nminor = current_minor_maps (NULL, &tmaps); | 7415 | nminor = current_minor_maps (NULL, &tmaps); |
| 7415 | maps = alloca ((nminor + 3) * sizeof *maps); | 7416 | maps = alloca ((nminor + 4) * sizeof *maps); |
| 7416 | nmaps = 0; | 7417 | nmaps = 0; |
| 7418 | tem = KVAR (current_kboard, Voverriding_terminal_local_map); | ||
| 7419 | if (!NILP (tem) && !NILP (Voverriding_local_map_menu_flag)) | ||
| 7420 | maps[nmaps++] = tem; | ||
| 7417 | if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem)) | 7421 | if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem)) |
| 7418 | maps[nmaps++] = tem; | 7422 | maps[nmaps++] = tem; |
| 7419 | memcpy (maps + nmaps, tmaps, nminor * sizeof (maps[0])); | 7423 | memcpy (maps + nmaps, tmaps, nminor * sizeof (maps[0])); |
| @@ -7938,7 +7942,8 @@ tool_bar_items (Lisp_Object reuse, int *nitems) | |||
| 7938 | to process. */ | 7942 | to process. */ |
| 7939 | 7943 | ||
| 7940 | /* Should overriding-terminal-local-map and overriding-local-map apply? */ | 7944 | /* Should overriding-terminal-local-map and overriding-local-map apply? */ |
| 7941 | if (!NILP (Voverriding_local_map_menu_flag)) | 7945 | if (!NILP (Voverriding_local_map_menu_flag) |
| 7946 | && !NILP (Voverriding_local_map)) | ||
| 7942 | { | 7947 | { |
| 7943 | /* Yes, use them (if non-nil) as well as the global map. */ | 7948 | /* Yes, use them (if non-nil) as well as the global map. */ |
| 7944 | maps = alloca (3 * sizeof *maps); | 7949 | maps = alloca (3 * sizeof *maps); |
| @@ -7958,8 +7963,11 @@ tool_bar_items (Lisp_Object reuse, int *nitems) | |||
| 7958 | Lisp_Object tem; | 7963 | Lisp_Object tem; |
| 7959 | ptrdiff_t nminor; | 7964 | ptrdiff_t nminor; |
| 7960 | nminor = current_minor_maps (NULL, &tmaps); | 7965 | nminor = current_minor_maps (NULL, &tmaps); |
| 7961 | maps = alloca ((nminor + 3) * sizeof *maps); | 7966 | maps = alloca ((nminor + 4) * sizeof *maps); |
| 7962 | nmaps = 0; | 7967 | nmaps = 0; |
| 7968 | tem = KVAR (current_kboard, Voverriding_terminal_local_map); | ||
| 7969 | if (!NILP (tem) && !NILP (Voverriding_local_map_menu_flag)) | ||
| 7970 | maps[nmaps++] = tem; | ||
| 7963 | if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem)) | 7971 | if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem)) |
| 7964 | maps[nmaps++] = tem; | 7972 | maps[nmaps++] = tem; |
| 7965 | memcpy (maps + nmaps, tmaps, nminor * sizeof (maps[0])); | 7973 | memcpy (maps + nmaps, tmaps, nminor * sizeof (maps[0])); |
| @@ -11443,10 +11451,7 @@ tool-bar separators natively. Otherwise it is unused (e.g. on GTK). */); | |||
| 11443 | 11451 | ||
| 11444 | DEFVAR_KBOARD ("overriding-terminal-local-map", | 11452 | DEFVAR_KBOARD ("overriding-terminal-local-map", |
| 11445 | Voverriding_terminal_local_map, | 11453 | Voverriding_terminal_local_map, |
| 11446 | doc: /* Per-terminal keymap that overrides all other local keymaps. | 11454 | doc: /* Per-terminal keymap that takes precedence over all other keymaps. |
| 11447 | If this variable is non-nil, it is used as a keymap instead of the | ||
| 11448 | buffer's local map, and the minor mode keymaps and text property keymaps. | ||
| 11449 | It also replaces `overriding-local-map'. | ||
| 11450 | 11455 | ||
| 11451 | This variable is intended to let commands such as `universal-argument' | 11456 | This variable is intended to let commands such as `universal-argument' |
| 11452 | set up a different keymap for reading the next command. | 11457 | set up a different keymap for reading the next command. |
| @@ -11456,7 +11461,7 @@ terminal device. | |||
| 11456 | See Info node `(elisp)Multiple Terminals'. */); | 11461 | See Info node `(elisp)Multiple Terminals'. */); |
| 11457 | 11462 | ||
| 11458 | DEFVAR_LISP ("overriding-local-map", Voverriding_local_map, | 11463 | DEFVAR_LISP ("overriding-local-map", Voverriding_local_map, |
| 11459 | doc: /* Keymap that overrides all other local keymaps. | 11464 | doc: /* Keymap that overrides almost all other local keymaps. |
| 11460 | If this variable is non-nil, it is used as a keymap--replacing the | 11465 | If this variable is non-nil, it is used as a keymap--replacing the |
| 11461 | buffer's local map, the minor mode keymaps, and char property keymaps. */); | 11466 | buffer's local map, the minor mode keymaps, and char property keymaps. */); |
| 11462 | Voverriding_local_map = Qnil; | 11467 | Voverriding_local_map = Qnil; |
diff --git a/src/keymap.c b/src/keymap.c index c43d528b25b..536db77f59b 100644 --- a/src/keymap.c +++ b/src/keymap.c | |||
| @@ -56,28 +56,28 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 56 | #include "keymap.h" | 56 | #include "keymap.h" |
| 57 | #include "window.h" | 57 | #include "window.h" |
| 58 | 58 | ||
| 59 | /* Actually allocate storage for these variables */ | 59 | /* Actually allocate storage for these variables. */ |
| 60 | 60 | ||
| 61 | Lisp_Object current_global_map; /* Current global keymap */ | 61 | Lisp_Object current_global_map; /* Current global keymap. */ |
| 62 | 62 | ||
| 63 | Lisp_Object global_map; /* default global key bindings */ | 63 | Lisp_Object global_map; /* Default global key bindings. */ |
| 64 | 64 | ||
| 65 | Lisp_Object meta_map; /* The keymap used for globally bound | 65 | Lisp_Object meta_map; /* The keymap used for globally bound |
| 66 | ESC-prefixed default commands */ | 66 | ESC-prefixed default commands. */ |
| 67 | 67 | ||
| 68 | Lisp_Object control_x_map; /* The keymap used for globally bound | 68 | Lisp_Object control_x_map; /* The keymap used for globally bound |
| 69 | C-x-prefixed default commands */ | 69 | C-x-prefixed default commands. */ |
| 70 | 70 | ||
| 71 | /* The keymap used by the minibuf for local | 71 | /* The keymap used by the minibuf for local |
| 72 | bindings when spaces are allowed in the | 72 | bindings when spaces are allowed in the |
| 73 | minibuf */ | 73 | minibuf. */ |
| 74 | 74 | ||
| 75 | /* The keymap used by the minibuf for local | 75 | /* The keymap used by the minibuf for local |
| 76 | bindings when spaces are not encouraged | 76 | bindings when spaces are not encouraged |
| 77 | in the minibuf */ | 77 | in the minibuf. */ |
| 78 | 78 | ||
| 79 | /* keymap used for minibuffers when doing completion */ | 79 | /* Keymap used for minibuffers when doing completion. */ |
| 80 | /* keymap used for minibuffers when doing completion and require a match */ | 80 | /* Keymap used for minibuffers when doing completion and require a match. */ |
| 81 | static Lisp_Object Qkeymapp, Qnon_ascii; | 81 | static Lisp_Object Qkeymapp, Qnon_ascii; |
| 82 | Lisp_Object Qkeymap, Qmenu_item, Qremap; | 82 | Lisp_Object Qkeymap, Qmenu_item, Qremap; |
| 83 | static Lisp_Object QCadvertised_binding; | 83 | static Lisp_Object QCadvertised_binding; |
| @@ -1571,17 +1571,14 @@ like in the respective argument of `key-binding'. */) | |||
| 1571 | } | 1571 | } |
| 1572 | } | 1572 | } |
| 1573 | 1573 | ||
| 1574 | if (!NILP (olp)) | 1574 | if (!NILP (olp) |
| 1575 | { | ||
| 1576 | if (!NILP (KVAR (current_kboard, Voverriding_terminal_local_map))) | ||
| 1577 | keymaps = Fcons (KVAR (current_kboard, Voverriding_terminal_local_map), | ||
| 1578 | keymaps); | ||
| 1579 | /* The doc said that overriding-terminal-local-map should | 1575 | /* The doc said that overriding-terminal-local-map should |
| 1580 | override overriding-local-map. The code used them both, | 1576 | override overriding-local-map. The code used them both, |
| 1581 | but it seems clearer to use just one. rms, jan 2005. */ | 1577 | but it seems clearer to use just one. rms, jan 2005. */ |
| 1582 | else if (!NILP (Voverriding_local_map)) | 1578 | && NILP (KVAR (current_kboard, Voverriding_terminal_local_map)) |
| 1583 | keymaps = Fcons (Voverriding_local_map, keymaps); | 1579 | && !NILP (Voverriding_local_map)) |
| 1584 | } | 1580 | keymaps = Fcons (Voverriding_local_map, keymaps); |
| 1581 | |||
| 1585 | if (NILP (XCDR (keymaps))) | 1582 | if (NILP (XCDR (keymaps))) |
| 1586 | { | 1583 | { |
| 1587 | Lisp_Object *maps; | 1584 | Lisp_Object *maps; |
| @@ -1592,6 +1589,7 @@ like in the respective argument of `key-binding'. */) | |||
| 1592 | Lisp_Object local_map = get_local_map (pt, current_buffer, Qlocal_map); | 1589 | Lisp_Object local_map = get_local_map (pt, current_buffer, Qlocal_map); |
| 1593 | /* This returns nil unless there is a `keymap' property. */ | 1590 | /* This returns nil unless there is a `keymap' property. */ |
| 1594 | Lisp_Object keymap = get_local_map (pt, current_buffer, Qkeymap); | 1591 | Lisp_Object keymap = get_local_map (pt, current_buffer, Qkeymap); |
| 1592 | Lisp_Object otlp = KVAR (current_kboard, Voverriding_terminal_local_map); | ||
| 1595 | 1593 | ||
| 1596 | if (CONSP (position)) | 1594 | if (CONSP (position)) |
| 1597 | { | 1595 | { |
| @@ -1656,6 +1654,9 @@ like in the respective argument of `key-binding'. */) | |||
| 1656 | 1654 | ||
| 1657 | if (!NILP (keymap)) | 1655 | if (!NILP (keymap)) |
| 1658 | keymaps = Fcons (keymap, keymaps); | 1656 | keymaps = Fcons (keymap, keymaps); |
| 1657 | |||
| 1658 | if (!NILP (olp) && !NILP (otlp)) | ||
| 1659 | keymaps = Fcons (otlp, keymaps); | ||
| 1659 | } | 1660 | } |
| 1660 | 1661 | ||
| 1661 | unbind_to (count, Qnil); | 1662 | unbind_to (count, Qnil); |
| @@ -2851,7 +2852,7 @@ You type Translation\n\ | |||
| 2851 | 2852 | ||
| 2852 | insert ("\n", 1); | 2853 | insert ("\n", 1); |
| 2853 | 2854 | ||
| 2854 | /* Insert calls signal_after_change which may GC. */ | 2855 | /* Insert calls signal_after_change which may GC. */ |
| 2855 | translate = SDATA (KVAR (current_kboard, Vkeyboard_translate_table)); | 2856 | translate = SDATA (KVAR (current_kboard, Vkeyboard_translate_table)); |
| 2856 | } | 2857 | } |
| 2857 | 2858 | ||
| @@ -2867,6 +2868,14 @@ You type Translation\n\ | |||
| 2867 | start1 = Qnil; | 2868 | start1 = Qnil; |
| 2868 | if (!NILP (KVAR (current_kboard, Voverriding_terminal_local_map))) | 2869 | if (!NILP (KVAR (current_kboard, Voverriding_terminal_local_map))) |
| 2869 | start1 = KVAR (current_kboard, Voverriding_terminal_local_map); | 2870 | start1 = KVAR (current_kboard, Voverriding_terminal_local_map); |
| 2871 | |||
| 2872 | if (!NILP (start1)) | ||
| 2873 | { | ||
| 2874 | describe_map_tree (start1, 1, shadow, prefix, | ||
| 2875 | "\f\nOverriding Bindings", nomenu, 0, 0, 0); | ||
| 2876 | shadow = Fcons (start1, shadow); | ||
| 2877 | start1 = Qnil; | ||
| 2878 | } | ||
| 2870 | else if (!NILP (Voverriding_local_map)) | 2879 | else if (!NILP (Voverriding_local_map)) |
| 2871 | start1 = Voverriding_local_map; | 2880 | start1 = Voverriding_local_map; |
| 2872 | 2881 | ||