GNU bug report logs -
#54161
27.2; `define-minor-mode' with alist of key bindings
Previous Next
Reported by: Drew Adams <drew.adams <at> oracle.com>
Date: Fri, 25 Feb 2022 17:49:02 UTC
Severity: normal
Found in version 27.2
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Hi Drew,
I don't understand the documentation in the same way. I don't think
the documentation is wrong, but it could always use a few examples.
> > where each KEY-SEQUENCE and DEFINITION are arguments suitable for
> > passing to 'define-key'.
> 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.
(define-minor-mode titi-mode
"TITI MODE" nil nil '(((kbd "C-o") . forward-char)))
(define-minor-mode tata-mode
"TATA MODE" nil nil '(("\\C-o" . forward-char)))
I would in fact expect titi to result in an error, since a list whose
car is the symbol kbd is not a valid key. But this seems to work, as I
would expect it to:
(define-minor-mode tutu-mode
"TUTU MODE" nil nil `((,(kbd "C-o") . forward-char)))
As for tata, it binds the four-character sequence {backslash, capital
C, dash, lowercase o}. To bind C-o, you need to pass the one-character
string "\C-o".
--
Gilles
This bug report was last modified 3 years and 134 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.