[Top][All Lists]

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

Re: master 859190f 2/3: Convert some keymaps to defvar-keymap

From: Stefan Kangas
Subject: Re: master 859190f 2/3: Convert some keymaps to defvar-keymap
Date: Tue, 12 Oct 2021 14:34:02 -0700

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Lars Ingebrigtsen <larsi@gnus.org> writes:
>> In the current Emacs tree, we have >7K instances of define-key with a
>> string as a parameter, and 441 with (kbd ...).
> And 258 on the [(control ?+)].

Right, but how much of that is preloaded code, how much is unchanged
since the 1990's, how much is written by core developers who can't use
`kbd' due to bootstrap and just got out of the habit, etc.?

In my case, I would definitely prefer to use kbd everywhere, but it
feels out of place to convert an entire string of bindings to my
preferred style just because I'm adding a keybinding.  So I don't do

IOW, I don't think that counting instances in core will necessarily lead
to a very representative sample of current Emacs Lisp in this case.

For comparison, here are the top packages on MELPA, excluding dash.el
and other library packages without keybindings:


Six different principal authors, but all of them use kbd.  I stopped
checking after markdown-mode, but all I checked before that uses kbd.

> (And as Eli said, `kbd' isn't something that we currently can use
> everywhere, because the implementation depends on (basically)
> everything.  If the `kbd' syntax is to be used in keymaps everywhere,
> somebody has to re-implement it to be self contained.)

Yeah, that would need fixing if we want to use it in preloaded code.

>From a quick glance, it looks like the meat of this is in
`edmacro-parse-keys'.  From there, you have a ton of calls to `cl-lib',
regexps and what have you.  But nothing in there looks like it should be
impossible to get in shape, even for early bootstrap, does it?

Personally though, I'd be quite happy even if we could just do what Juri
said and add a :kbd keyword to defvar-keymap (t by default), and use
:kbd nil in our preloaded code.  I'm pretty sure that at least the above
package authors (the "kbd" users) would also be happy.  It's too nice of
an addition to Emacs Lisp to not get it all the way over the finish
line when we have the chance.

reply via email to

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