Subject: RE: [External] : bug#54161: 27.2; `define-minor-mode' with alist of key bindings

From: Drew Adams <[email-masked]>
Date: Sat, 26 Feb 2022 03:20:27 +0000

> > > where each KEY-SEQUENCE and DEFINITION are arguments suitable for
> > > passing to 'define-key'.

As a starter, it would be better to say "arguments suitable
for `define-key', and not speak of what you "pass" to it.

> > I think that's the case in these examples, no?  Both (kbd "C-o") and
> > "\C-o" are suitable args for `define-key'.
> 
> The Lisp object (kbd "C-o") (a two-element list) is not a suitable
> argument for define-key. The Lisp *expression* (kbd "C-o") *returns*
> a suitable argument for define-key.

Sure.  It depends on how one reads "passing" an arg.  And
notice that you wrote "suitable argument for define-key,
which already shifts the focus to what the function accepts
and not to what you "pass" it.

A user writes an argument expression in a function-application
expression "(define-key...)".  Lisp evals each argument
expression and applies the function that's the car of the
overall expression to the evaluated arg expressions.

The function receives Lisp objects. The user writes an
expression - especially in the typical case of using
`define-key' or `:keymap'.

It's easy to read "passing" as being about the expressions
you write, even if that's not ultimately all that's involved.
And especially for something like `define-key' and arg
expressions like (kbd...).

The odd "tolerance" (if that's what it is) of (kbd "<")
confuses things further wrt the behavior.  As agreed in
the source Q&A in emacs.SE, neither of us understands why
the same error is NOT raised for (kbd "<") as is raised
for (kbd "C-<").  In both cases if the alist arg to
:keymap is quoted then what gets passed is a 2-element
list with car `kbd'.  Why does (kbd "<") work?  That can
lead (did lead) to the confusion about (kbd "C-<").

"Something you can pass to define-key" can mislead, even
if correct when viewed right.  This should be worded in
some less ambiguous way in the doc.  It's possible to think
of "passing" (kbd "C->") to define-key - it all depends on
how one interprets "passing" something to a function.

An example in the doc would help, along with speaking of
something "acceptable to `define-key' as an arg - something
such as what `kbd returns."  Putting the emphasis on what
the function accepts rather than on what you "pass" can tend
to shift the focus from an expression you write to the result
of its evaluation, which is what the function receives.

Yes, the function is passed the result of evaluating the
sexp.  But it's easy to think of what you write as being
what you "pass" to the function.  Especially if you try
"passing" (writing) "(kbd ">")" and no error is raised.
It's the inconsistency that misled, and made the user
think that there was a particular problem with (kbd "C->").