emacs-devel
[Top][All Lists]
Advanced

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

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


From: Lars Ingebrigtsen
Subject: Re: master 859190f 2/3: Convert some keymaps to defvar-keymap
Date: Thu, 14 Oct 2021 23:11:53 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> (define-key map [TAB] 'todo-next-button)
>>
>> but I guess it's fine...
>
> No, the `kbd` syntax for `tab` is "<tab>".

Yeah, I meant we could probably work around that for these keys and
allow both syntaxes.

> I guess we could also accept `C-<delete>`, but I think it would be
> better to catch it and signal an error.

Yup.

>> Oh, yeah, I had totally forgotten that this is how menus are defined.
>> To it's ambiguous here -- the thing in [] could be anything, including
>> [s], which kdb would interpret as the key "s".
>
> This area of Emacs is tricky enough that we may encounter surprises, but
> I think using [?s] for such a menu entry "key binding" would work just
> fine, currently.

Hm...  I have admittedly not tested this, but I thought it might collide
with the way things like facemenu defines its keymap, with the `cons'
definition.

(local-set-key "\C-c\C-c"
               (define-keymap
                 :name "Zot"
                 [?k] '("foo" . ignore)
                 [?z] '("bar" . ignore)))

Yup, that binds `C-c C-c k'.

>> This form is limited to menu items, though, so perhaps it could be made
>> to work (i.e., if the DEF is a menu item, then we have different logic).
>
> I'd rather not go there.

Me neither, since there's also

    (define-key map [sepmv] '("--"))

For one bright, shiny moment I thought we could look into the keymap and
see whether the keymap "is a menu", but the only hint that they are is
that they have a name.  And as we saw in the code snippet, that's not
exclusive to actual menus, but also to those oddball
prompt-in-the-minibuffer "menus".

So I think that the [C-c C-k] syntax doesn't quite work unambiguously.

Unless I'm missing something, which I might well be.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



reply via email to

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