[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Moving kbd to subr.el

From: Juri Linkov
Subject: Re: Moving kbd to subr.el
Date: Mon, 18 Oct 2021 19:01:05 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu)

> Can't we impose pretty much any syntax we like in new forms, such as
> 'defvar-keymap' and 'kbd-valid-p'?
> I'm looking at a fragment like this:
>    "P"         #'cvs-status-prev
> -  (kbd "M-n") #'cvs-status-next
> -  (kbd "M-p") #'cvs-status-prev
> +  ["M-n"]     #'cvs-status-next
> +  ["M-p"]     #'cvs-status-prev
>    "t"         #'cvs-status-cvstrees
> And I feel like it would be nice if we could avoid putting these
> strings in a vector.  Especially if we don't do it consistently.

It would be perfect if new defvar-keymap would use kbd-strict syntax.
Then replacing define-key with define-keymap will also replace
the string syntax - safely, and as we already discussed allowing
old syntax optionally by using a keyword like ':kbd nil'.

> At the same time, maybe I don't understand the overreaching plan.  Is
> the idea to be able to replace any use of (kbd "M-x") with ["M-x"]
> everywhere, including in 'define-key' et al?

Any use of (kbd "M-x") can't be replaced with ["M-x"].
For example, this use from (info "(elisp) Functions for Key Lookup")

  (lookup-key (current-global-map) (kbd "C-x C-f"))

can't be replaced with:

  (lookup-key (current-global-map) ["C-x C-f"])

reply via email to

[Prev in Thread] Current Thread [Next in Thread]