Subject: Re: bug#75933: 29; Disabling smerge-command-prefix results in error

From: Jonas Bernoulli <[email-masked]>
Date: Thu, 06 Feb 2025 14:50:04 +0100

Stefan Monnier <[email-masked]> writes:

>>   (easy-mmode-defmap smerge-mode-map
>>     `((,smerge-command-prefix . ,smerge-basic-map))
>>     "Keymap for `smerge-mode'.")
>>
>> In Emacs 29.1 (after 2ae3b66fa80 and some fixup commits), the former
>> remained as it was in 28, but the latter was replaced with:
>>
>>   (defvar-keymap smerge-mode-map
>>     (key-description smerge-command-prefix) smerge-basic-map)
>>
>> Setting the option to "", to add no prefix command, results in:
>>
>>   keymap--check: "" is not a valid key definition; see `key-valid-p'
>
> Emacs Emacs<29 setting the option to "" resulted in keeping
> `smerge-mode-map` empty, AFAICT.  Is that what you wanted or did you
> expect all the bindings of `smerge-basic-map` to be made available
> without a prefix?

Well *I* am perfectly happy with the defaults.  But there's at least one
Magit user who never uses Smerge and thus doesn't want keymaps cluttered
with its bindings.

> To my mind the value "" would be closer to meaning that all the bindings
> of `smerge-basic-map` should be made available without a prefix, and if
> we want to allow the bindings to be completely absent, it might make
> more sense to use a nil value.

That does make sense to me too, but I don't think that users who have
set this to "", to not even use a top-level binding for Smerge commands,
would be happy if the meaning were changed to add *multiple* top-level
bindings, that's worse for them than the default of one prefix keymap.
So it might be better to use two new symbols, such as 'top-level and
'none, and make "" a backward compatibility alias for 'none.