[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: master 859190f 2/3: Convert some keymaps to defvar-keymap
From: |
Gregory Heytings |
Subject: |
Re: master 859190f 2/3: Convert some keymaps to defvar-keymap |
Date: |
Thu, 14 Oct 2021 13:41:02 +0000 |
But such a key sequence would not be transformed by kbd, because it
does not contain "C-" or something similar.
The thing I pasted up there was a literal evaluation of the form.
Sorry for the confusion, what I said was unclear: with the proposed (proof
of concept) patch (see below), such a sequence would not be transformed by
kbd, because it does not contain "C-" or something similar.
diff --git a/src/keymap.c b/src/keymap.c
index be45d2be1e..8e0a99a4b0 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -1059,6 +1059,15 @@ DEFUN ("define-key", Fdefine_key, Sdefine_key, 3, 3, 0,
{
bool metized = false;
+ Lisp_Object kbd_key;
+ if (STRINGP (key) &&
+ (strstr (SSDATA (key), "C-") || strstr (SSDATA (key), "M-") ||
+ strstr (SSDATA (key), "S-") || strstr (SSDATA (key), "H-") ||
+ strstr (SSDATA (key), "s-")) &&
+ !NILP (Ffboundp (Qkbd)) &&
+ !NILP (kbd_key = safe_call1 (Qkbd, key)))
+ key = kbd_key;
+
keymap = get_keymap (keymap, 1, 1);
ptrdiff_t length = CHECK_VECTOR_OR_STRING (key);
@@ -3261,4 +3270,6 @@ syms_of_keymap (void)
defsubr (&Stext_char_description);
defsubr (&Swhere_is_internal);
defsubr (&Sdescribe_buffer_bindings);
+
+ DEFSYM (Qkbd, "kbd");
}
- Re: master 859190f 2/3: Convert some keymaps to defvar-keymap, (continued)
- Re: master 859190f 2/3: Convert some keymaps to defvar-keymap, Eli Zaretskii, 2021/10/14
- Re: master 859190f 2/3: Convert some keymaps to defvar-keymap, Gregory Heytings, 2021/10/14
- Re: master 859190f 2/3: Convert some keymaps to defvar-keymap, Stefan Kangas, 2021/10/14
- Re: master 859190f 2/3: Convert some keymaps to defvar-keymap, Lars Ingebrigtsen, 2021/10/14
- Re: master 859190f 2/3: Convert some keymaps to defvar-keymap, Gregory Heytings, 2021/10/14
- Re: master 859190f 2/3: Convert some keymaps to defvar-keymap, Lars Ingebrigtsen, 2021/10/14
- Re: master 859190f 2/3: Convert some keymaps to defvar-keymap, Gregory Heytings, 2021/10/14
- Re: master 859190f 2/3: Convert some keymaps to defvar-keymap, Lars Ingebrigtsen, 2021/10/14
- Re: master 859190f 2/3: Convert some keymaps to defvar-keymap, Gregory Heytings, 2021/10/14
- Re: master 859190f 2/3: Convert some keymaps to defvar-keymap, Lars Ingebrigtsen, 2021/10/14
- Re: master 859190f 2/3: Convert some keymaps to defvar-keymap,
Gregory Heytings <=
- Re: master 859190f 2/3: Convert some keymaps to defvar-keymap, Lars Ingebrigtsen, 2021/10/14
- Re: master 859190f 2/3: Convert some keymaps to defvar-keymap, Gregory Heytings, 2021/10/14
- Re: master 859190f 2/3: Convert some keymaps to defvar-keymap, Lars Ingebrigtsen, 2021/10/14
- Re: master 859190f 2/3: Convert some keymaps to defvar-keymap, Gregory Heytings, 2021/10/14
- Re: master 859190f 2/3: Convert some keymaps to defvar-keymap, Stefan Kangas, 2021/10/14
- Re: master 859190f 2/3: Convert some keymaps to defvar-keymap, Lars Ingebrigtsen, 2021/10/14
- Re: master 859190f 2/3: Convert some keymaps to defvar-keymap, Gregory Heytings, 2021/10/14
- Re: master 859190f 2/3: Convert some keymaps to defvar-keymap, Lars Ingebrigtsen, 2021/10/14
- Re: master 859190f 2/3: Convert some keymaps to defvar-keymap, Stefan Monnier, 2021/10/14
- Re: master 859190f 2/3: Convert some keymaps to defvar-keymap, Stefan Kangas, 2021/10/14