diff options
| author | Richard M. Stallman | 1995-02-26 21:04:52 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-02-26 21:04:52 +0000 |
| commit | f09bc9246449428644601982bd86f5bbe5eb110b (patch) | |
| tree | 9cc5d004d440b09d8e0d78c1281ef5bf4682d13c /src/keymap.c | |
| parent | 39eaa782753bacb4cfa03f64c2ba4120edc5dc5f (diff) | |
| download | emacs-f09bc9246449428644601982bd86f5bbe5eb110b.tar.gz emacs-f09bc9246449428644601982bd86f5bbe5eb110b.zip | |
(Fdefine_key): Handle Lucid-style (crtl backspace) etc.
(Flookup_key): Likewise.
Diffstat (limited to 'src/keymap.c')
| -rw-r--r-- | src/keymap.c | 78 |
1 files changed, 6 insertions, 72 deletions
diff --git a/src/keymap.c b/src/keymap.c index bfa8b219202..abceaa50305 100644 --- a/src/keymap.c +++ b/src/keymap.c | |||
| @@ -607,6 +607,9 @@ the front of KEYMAP.") | |||
| 607 | { | 607 | { |
| 608 | c = Faref (key, make_number (idx)); | 608 | c = Faref (key, make_number (idx)); |
| 609 | 609 | ||
| 610 | if (CONSP (c) && lucid_event_type_list_p (c)) | ||
| 611 | c = convert_event_type_list (c); | ||
| 612 | |||
| 610 | if (INTEGERP (c) | 613 | if (INTEGERP (c) |
| 611 | && (XINT (c) & meta_bit) | 614 | && (XINT (c) & meta_bit) |
| 612 | && !metized) | 615 | && !metized) |
| @@ -698,6 +701,9 @@ recognize the default bindings, just as `read-key-sequence' does.") | |||
| 698 | { | 701 | { |
| 699 | c = Faref (key, make_number (idx)); | 702 | c = Faref (key, make_number (idx)); |
| 700 | 703 | ||
| 704 | if (CONSP (c) && lucid_event_type_list_p (c)) | ||
| 705 | c = convert_event_type_list (c); | ||
| 706 | |||
| 701 | if (INTEGERP (c) | 707 | if (INTEGERP (c) |
| 702 | && (XINT (c) & meta_bit) | 708 | && (XINT (c) & meta_bit) |
| 703 | && !metized) | 709 | && !metized) |
| @@ -999,74 +1005,6 @@ bindings; see the description of `lookup-key' for more details about this.") | |||
| 999 | return Flist (j, maps); | 1005 | return Flist (j, maps); |
| 1000 | } | 1006 | } |
| 1001 | 1007 | ||
| 1002 | DEFUN ("global-set-key", Fglobal_set_key, Sglobal_set_key, 2, 2, | ||
| 1003 | "KSet key globally: \nCSet key %s to command: ", | ||
| 1004 | "Give KEY a global binding as COMMAND.\n\ | ||
| 1005 | COMMAND is a symbol naming an interactively-callable function.\n\ | ||
| 1006 | KEY is a key sequence (a string or vector of characters or event types).\n\ | ||
| 1007 | Non-ASCII characters with codes above 127 (such as ISO Latin-1)\n\ | ||
| 1008 | can be included if you use a vector.\n\ | ||
| 1009 | Note that if KEY has a local binding in the current buffer\n\ | ||
| 1010 | that local binding will continue to shadow any global binding.") | ||
| 1011 | (keys, function) | ||
| 1012 | Lisp_Object keys, function; | ||
| 1013 | { | ||
| 1014 | if (!VECTORP (keys) && !STRINGP (keys)) | ||
| 1015 | keys = wrong_type_argument (Qarrayp, keys); | ||
| 1016 | |||
| 1017 | Fdefine_key (current_global_map, keys, function); | ||
| 1018 | return Qnil; | ||
| 1019 | } | ||
| 1020 | |||
| 1021 | DEFUN ("local-set-key", Flocal_set_key, Slocal_set_key, 2, 2, | ||
| 1022 | "KSet key locally: \nCSet key %s locally to command: ", | ||
| 1023 | "Give KEY a local binding as COMMAND.\n\ | ||
| 1024 | COMMAND is a symbol naming an interactively-callable function.\n\ | ||
| 1025 | KEY is a key sequence (a string or vector of characters or event types).\n\ | ||
| 1026 | Non-ASCII characters with codes above 127 (such as ISO Latin-1)\n\ | ||
| 1027 | can be included if you use a vector.\n\ | ||
| 1028 | The binding goes in the current buffer's local map,\n\ | ||
| 1029 | which in most cases is shared with all other buffers in the same major mode.") | ||
| 1030 | (keys, function) | ||
| 1031 | Lisp_Object keys, function; | ||
| 1032 | { | ||
| 1033 | register Lisp_Object map; | ||
| 1034 | map = current_buffer->keymap; | ||
| 1035 | if (NILP (map)) | ||
| 1036 | { | ||
| 1037 | map = Fmake_sparse_keymap (Qnil); | ||
| 1038 | current_buffer->keymap = map; | ||
| 1039 | } | ||
| 1040 | |||
| 1041 | if (!VECTORP (keys) && !STRINGP (keys)) | ||
| 1042 | keys = wrong_type_argument (Qarrayp, keys); | ||
| 1043 | |||
| 1044 | Fdefine_key (map, keys, function); | ||
| 1045 | return Qnil; | ||
| 1046 | } | ||
| 1047 | |||
| 1048 | DEFUN ("global-unset-key", Fglobal_unset_key, Sglobal_unset_key, | ||
| 1049 | 1, 1, "kUnset key globally: ", | ||
| 1050 | "Remove global binding of KEY.\n\ | ||
| 1051 | KEY is a string representing a sequence of keystrokes.") | ||
| 1052 | (keys) | ||
| 1053 | Lisp_Object keys; | ||
| 1054 | { | ||
| 1055 | return Fglobal_set_key (keys, Qnil); | ||
| 1056 | } | ||
| 1057 | |||
| 1058 | DEFUN ("local-unset-key", Flocal_unset_key, Slocal_unset_key, 1, 1, | ||
| 1059 | "kUnset key locally: ", | ||
| 1060 | "Remove local binding of KEY.\n\ | ||
| 1061 | KEY is a string representing a sequence of keystrokes.") | ||
| 1062 | (keys) | ||
| 1063 | Lisp_Object keys; | ||
| 1064 | { | ||
| 1065 | if (!NILP (current_buffer->keymap)) | ||
| 1066 | Flocal_set_key (keys, Qnil); | ||
| 1067 | return Qnil; | ||
| 1068 | } | ||
| 1069 | |||
| 1070 | DEFUN ("define-prefix-command", Fdefine_prefix_command, Sdefine_prefix_command, 1, 2, 0, | 1008 | DEFUN ("define-prefix-command", Fdefine_prefix_command, Sdefine_prefix_command, 1, 2, 0, |
| 1071 | "Define COMMAND as a prefix command. COMMAND should be a symbol.\n\ | 1009 | "Define COMMAND as a prefix command. COMMAND should be a symbol.\n\ |
| 1072 | A new sparse keymap is stored as COMMAND's function definition and its value.\n\ | 1010 | A new sparse keymap is stored as COMMAND's function definition and its value.\n\ |
| @@ -2486,12 +2424,8 @@ key, typing `ESC O P x' would return [f1 x]."); | |||
| 2486 | defsubr (&Slocal_key_binding); | 2424 | defsubr (&Slocal_key_binding); |
| 2487 | defsubr (&Sglobal_key_binding); | 2425 | defsubr (&Sglobal_key_binding); |
| 2488 | defsubr (&Sminor_mode_key_binding); | 2426 | defsubr (&Sminor_mode_key_binding); |
| 2489 | defsubr (&Sglobal_set_key); | ||
| 2490 | defsubr (&Slocal_set_key); | ||
| 2491 | defsubr (&Sdefine_key); | 2427 | defsubr (&Sdefine_key); |
| 2492 | defsubr (&Slookup_key); | 2428 | defsubr (&Slookup_key); |
| 2493 | defsubr (&Sglobal_unset_key); | ||
| 2494 | defsubr (&Slocal_unset_key); | ||
| 2495 | defsubr (&Sdefine_prefix_command); | 2429 | defsubr (&Sdefine_prefix_command); |
| 2496 | defsubr (&Suse_global_map); | 2430 | defsubr (&Suse_global_map); |
| 2497 | defsubr (&Suse_local_map); | 2431 | defsubr (&Suse_local_map); |