diff options
| author | Lars Ingebrigtsen | 2021-11-16 08:15:43 +0100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2021-11-16 08:26:24 +0100 |
| commit | de477ec683482a5dd27d791d7fdcfc4021ed3cb7 (patch) | |
| tree | e76ae6aa9969b07cf71bb57651ac2368327d1bf8 /src/keymap.c | |
| parent | 560c921ed8d2d14e593aaee68b8be57b189128e5 (diff) | |
| download | emacs-de477ec683482a5dd27d791d7fdcfc4021ed3cb7.tar.gz emacs-de477ec683482a5dd27d791d7fdcfc4021ed3cb7.zip | |
Add new 'keymap-*' functions
* lisp/keymap.el: New file with all the new keymap-* functions.
* lisp/loadup.el ("keymap"): Load.
* lisp/subr.el (kbd): Refactor out all the code to key-parse.
(define-key-after, keyboard-translate, global-set-key)
(local-set-key, global-unset-key, local-unset-key)
(local-key-binding, global-key-binding)
(substitute-key-definition): Note in doc strings that these are
legacy functions.
(define-keymap--define): Use keymap-set.
* lisp/emacs-lisp/byte-opt.el: Remove the optimizations for
defvar-keymap and define-keymap since the macros now only
understand the kbd syntax.
* lisp/emacs-lisp/bytecomp.el (byte-compile-define-keymap)
(byte-compile-define-keymap--define): Warn about invalid key
definitions in all keymap-* functions.
* lisp/emacs-lisp/shortdoc.el (keymaps): Add shortdocs form
keymap* functions.
* src/keymap.c (possibly_translate_key_sequence): Adjust callers
to key-valid-p and key-parse.
(syms_of_keymap): Adjust defs.
Diffstat (limited to 'src/keymap.c')
| -rw-r--r-- | src/keymap.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/keymap.c b/src/keymap.c index c6990cffaf6..7993e31ac6d 100644 --- a/src/keymap.c +++ b/src/keymap.c | |||
| @@ -1053,16 +1053,16 @@ possibly_translate_key_sequence (Lisp_Object key, ptrdiff_t *length) | |||
| 1053 | { | 1053 | { |
| 1054 | /* KEY is on the ["C-c"] format, so translate to internal | 1054 | /* KEY is on the ["C-c"] format, so translate to internal |
| 1055 | format. */ | 1055 | format. */ |
| 1056 | if (NILP (Ffboundp (Qkbd_valid_p))) | 1056 | if (NILP (Ffboundp (Qkey_valid_p))) |
| 1057 | xsignal2 (Qerror, | 1057 | xsignal2 (Qerror, |
| 1058 | build_string ("`kbd-valid-p' is not defined, so this syntax can't be used: %s"), | 1058 | build_string ("`key-valid-p' is not defined, so this syntax can't be used: %s"), |
| 1059 | key); | 1059 | key); |
| 1060 | if (NILP (call1 (Qkbd_valid_p, AREF (key, 0)))) | 1060 | if (NILP (call1 (Qkey_valid_p, AREF (key, 0)))) |
| 1061 | xsignal2 (Qerror, build_string ("Invalid `kbd' syntax: %S"), key); | 1061 | xsignal2 (Qerror, build_string ("Invalid `key-parse' syntax: %S"), key); |
| 1062 | key = call1 (Qkbd, AREF (key, 0)); | 1062 | key = call1 (Qkey_parse, AREF (key, 0)); |
| 1063 | *length = CHECK_VECTOR_OR_STRING (key); | 1063 | *length = CHECK_VECTOR_OR_STRING (key); |
| 1064 | if (*length == 0) | 1064 | if (*length == 0) |
| 1065 | xsignal2 (Qerror, build_string ("Invalid `kbd' syntax: %S"), key); | 1065 | xsignal2 (Qerror, build_string ("Invalid `key-parse' syntax: %S"), key); |
| 1066 | } | 1066 | } |
| 1067 | 1067 | ||
| 1068 | return key; | 1068 | return key; |
| @@ -3458,6 +3458,6 @@ that describe key bindings. That is why the default is nil. */); | |||
| 3458 | defsubr (&Swhere_is_internal); | 3458 | defsubr (&Swhere_is_internal); |
| 3459 | defsubr (&Sdescribe_buffer_bindings); | 3459 | defsubr (&Sdescribe_buffer_bindings); |
| 3460 | 3460 | ||
| 3461 | DEFSYM (Qkbd, "kbd"); | 3461 | DEFSYM (Qkey_parse, "key-parse"); |
| 3462 | DEFSYM (Qkbd_valid_p, "kbd-valid-p"); | 3462 | DEFSYM (Qkey_valid_p, "key-valid-p"); |
| 3463 | } | 3463 | } |