[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: master 859190f 2/3: Convert some keymaps to defvar-keymap
From: |
Eli Zaretskii |
Subject: |
Re: master 859190f 2/3: Convert some keymaps to defvar-keymap |
Date: |
Wed, 13 Oct 2021 15:55:33 +0300 |
> Date: Wed, 13 Oct 2021 08:54:20 +0000
> From: Gregory Heytings <gregory@heytings.org>
> Cc: Stefan Kangas <stefankangas@gmail.com>, emacs-devel@gnu.org
>
> Is this not possible as follows (it's a POC), without introducing a new
> function?
>
> diff --git a/src/keymap.c b/src/keymap.c
> index be45d2be1e..7cad7cb4d1 100644
> --- a/src/keymap.c
> +++ b/src/keymap.c
> @@ -1059,6 +1059,11 @@ DEFUN ("define-key", Fdefine_key, Sdefine_key, 3,
> 3, 0,
> {
> bool metized = false;
>
> + if (STRINGP (key) &&
> + (strstr (SSDATA (key), "C-") || strstr (SSDATA (key), "M-")) &&
> + !NILP (Ffboundp (Qkbd)))
> + key = safe_call1 (Qkbd, key);
> +
> keymap = get_keymap (keymap, 1, 1);
>
> ptrdiff_t length = CHECK_VECTOR_OR_STRING (key);
> @@ -3261,4 +3266,6 @@ syms_of_keymap (void)
> defsubr (&Stext_char_description);
> defsubr (&Swhere_is_internal);
> defsubr (&Sdescribe_buffer_bindings);
> +
> + DEFSYM (Qkbd, "kbd");
> }
If the "kbd" call fails for some reason, safe_call1 will return nil,
and what will that do to the rest of the code?
Also, I think doing this effectively means preloading kbd.el, because
define-key is used in many places in packages we preload. Or am I
missing something?
- Re: Moving kbd to subr.el, (continued)
- Re: Representing key sequences, Lars Ingebrigtsen, 2021/10/13
- Re: Representing key sequences, Andreas Schwab, 2021/10/13
- Re: master 859190f 2/3: Convert some keymaps to defvar-keymap, Gregory Heytings, 2021/10/13
- Re: master 859190f 2/3: Convert some keymaps to defvar-keymap, Lars Ingebrigtsen, 2021/10/13
- Re: master 859190f 2/3: Convert some keymaps to defvar-keymap, Gregory Heytings, 2021/10/13
- Re: master 859190f 2/3: Convert some keymaps to defvar-keymap, Lars Ingebrigtsen, 2021/10/13
- Re: master 859190f 2/3: Convert some keymaps to defvar-keymap,
Eli Zaretskii <=
- Re: master 859190f 2/3: Convert some keymaps to defvar-keymap, Gregory Heytings, 2021/10/13
- Re: master 859190f 2/3: Convert some keymaps to defvar-keymap, Eli Zaretskii, 2021/10/13
- Re: master 859190f 2/3: Convert some keymaps to defvar-keymap, Gregory Heytings, 2021/10/13
- Re: master 859190f 2/3: Convert some keymaps to defvar-keymap, Lars Ingebrigtsen, 2021/10/13
- Re: master 859190f 2/3: Convert some keymaps to defvar-keymap, Stefan Kangas, 2021/10/13
- Re: master 859190f 2/3: Convert some keymaps to defvar-keymap, Gregory Heytings, 2021/10/13
- Re: master 859190f 2/3: Convert some keymaps to defvar-keymap, Eli Zaretskii, 2021/10/13
- Re: master 859190f 2/3: Convert some keymaps to defvar-keymap, Gregory Heytings, 2021/10/13
- Re: master 859190f 2/3: Convert some keymaps to defvar-keymap, Eli Zaretskii, 2021/10/13
- Re: master 859190f 2/3: Convert some keymaps to defvar-keymap, Gregory Heytings, 2021/10/13