GNU bug report logs -
#52523
29.0.50; defcustom :type 'key-sequence not following key-valid-p format
Previous Next
Reported by: Stefan Kangas <stefan <at> marxist.se>
Date: Wed, 15 Dec 2021 20:36:02 UTC
Severity: normal
Tags: patch
Found in version 29.0.50
Fixed in version 29.1
Done: Stefan Kangas <stefan <at> marxist.se>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 52523 in the body.
You can then email your comments to 52523 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52523
; Package
emacs
.
(Wed, 15 Dec 2021 20:36:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Stefan Kangas <stefan <at> marxist.se>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Wed, 15 Dec 2021 20:36:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Now that we prefer the key-valid-p format, we should think about what to
do about defcustom as well. We currently have that:
(defcustom foo "C-a" "" :type 'key-sequence)
Followed by `M-x customize-option RET foo RET' leads to a customize
buffer where this is displayed as "C - a". IOW, there is only support
for the legacy format "\C-a".
We can't just change this in a backwards incompatible way, but perhaps
we should document it as deprecated and introduce a new format for the
new type?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52523
; Package
emacs
.
(Thu, 16 Dec 2021 17:36:04 GMT)
Full text and
rfc822 format available.
Message #8 received at 52523 <at> debbugs.gnu.org (full text, mbox):
> Now that we prefer the key-valid-p format, we should think about what to
> do about defcustom as well. We currently have that:
>
> (defcustom foo "C-a" "" :type 'key-sequence)
>
> Followed by `M-x customize-option RET foo RET' leads to a customize
> buffer where this is displayed as "C - a". IOW, there is only support
> for the legacy format "\C-a".
>
> We can't just change this in a backwards incompatible way, but perhaps
> we should document it as deprecated and introduce a new format for the
> new type?
Indeed, a new type would be preferable. How about
:type 'kbd
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52523
; Package
emacs
.
(Sun, 19 Dec 2021 12:16:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 52523 <at> debbugs.gnu.org (full text, mbox):
Juri Linkov <juri <at> linkov.net> writes:
> Indeed, a new type would be preferable. How about
>
> :type 'kbd
A new type would be good, but we're not using the `kbd' name explicitly
in `key-valid-p' etc, so perhaps we could come up with a different name.
But I have no suggestions. 🤐
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52523
; Package
emacs
.
(Sun, 19 Dec 2021 13:44:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 52523 <at> debbugs.gnu.org (full text, mbox):
Lars Ingebrigtsen <larsi <at> gnus.org> writes:
> Juri Linkov <juri <at> linkov.net> writes:
>
>> Indeed, a new type would be preferable. How about
>>
>> :type 'kbd
>
> A new type would be good, but we're not using the `kbd' name explicitly
> in `key-valid-p' etc, so perhaps we could come up with a different name.
> But I have no suggestions. 🤐
How about
:type 'key-binding
?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52523
; Package
emacs
.
(Sun, 19 Dec 2021 13:55:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 52523 <at> debbugs.gnu.org (full text, mbox):
Stefan Kangas <stefan <at> marxist.se> writes:
> How about
>
> :type 'key-binding
>
> ?
Looks good to me.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52523
; Package
emacs
.
(Sun, 19 Dec 2021 17:21:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 52523 <at> debbugs.gnu.org (full text, mbox):
> Lars Ingebrigtsen <larsi <at> gnus.org> writes:
>
>> Juri Linkov <juri <at> linkov.net> writes:
>>
>>> Indeed, a new type would be preferable. How about
>>>
>>> :type 'kbd
>>
>> A new type would be good, but we're not using the `kbd' name explicitly
>> in `key-valid-p' etc, so perhaps we could come up with a different name.
>> But I have no suggestions. 🤐
>
> How about
>
> :type 'key-binding
Or simply :type 'keys?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52523
; Package
emacs
.
(Mon, 20 Dec 2021 07:00:02 GMT)
Full text and
rfc822 format available.
Message #23 received at 52523 <at> debbugs.gnu.org (full text, mbox):
Juri Linkov <juri <at> linkov.net> writes:
>> How about
>>
>> :type 'key-binding
>
> Or simply :type 'keys?
It sounds like you are supposed to provide a list to that type, I think?
If we are going short, how about :type 'key?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52523
; Package
emacs
.
(Tue, 21 Dec 2021 04:08:02 GMT)
Full text and
rfc822 format available.
Message #26 received at 52523 <at> debbugs.gnu.org (full text, mbox):
Juri Linkov <juri <at> linkov.net> writes:
>> If we are going short, how about :type 'key?
>
> But it's not a key, it's a key sequence.
We'll, we're kinda sloppy in the terminology here, so I think any of
these are fine -- key-binding, keys, key.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52523
; Package
emacs
.
(Tue, 21 Dec 2021 11:20:01 GMT)
Full text and
rfc822 format available.
Message #29 received at 52523 <at> debbugs.gnu.org (full text, mbox):
Lars Ingebrigtsen <larsi <at> gnus.org> writes:
> We'll, we're kinda sloppy in the terminology here, so I think any of
> these are fine -- key-binding, keys, key.
FWIW, I find the plural "keys" confusing, but other than that any of the
suggestions proposed so far are fine by me as well.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52523
; Package
emacs
.
(Tue, 21 Dec 2021 19:15:02 GMT)
Full text and
rfc822 format available.
Message #32 received at 52523 <at> debbugs.gnu.org (full text, mbox):
>> We'll, we're kinda sloppy in the terminology here, so I think any of
>> these are fine -- key-binding, keys, key.
>
> FWIW, I find the plural "keys" confusing, but other than that any of the
> suggestions proposed so far are fine by me as well.
I agree. OTOH, I still see no problem with 'kbd', or even 'kbd-sequence'.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52523
; Package
emacs
.
(Wed, 22 Dec 2021 04:17:01 GMT)
Full text and
rfc822 format available.
Message #35 received at 52523 <at> debbugs.gnu.org (full text, mbox):
[[[ To any NSA and FBI agents reading my email: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
> Now that we prefer the key-valid-p format, we should think about what to
> do about defcustom as well. We currently have that:
> (defcustom foo "C-a" "" :type 'key-sequence)
That defcustom seems to use incorrect syntax for its initial value.
Here are two real ones:
(defcustom outline-minor-mode-prefix "\C-c@"
"Prefix key to use for Outline commands in Outline minor mode.
The value of this variable is checked as part of loading Outline mode.
After that, changing the prefix key requires manipulating keymaps."
:type 'key-sequence
:initialize 'custom-initialize-default
...)
(defcustom gud-key-prefix "\C-x\C-a"
"Prefix of all GUD commands valid in C buffers."
:type 'key-sequence)
They both use the literal string syntax, rather than our new
user-friendly `kbd' syntax, but the value is a valid key sequence.
> Followed by `M-x customize-option RET foo RET' leads to a customize
> buffer where this is displayed as "C - a". IOW, there is only support
> for the legacy format "\C-a".
M-x customize-option RET gud-key-prefix RET shows this:
Hide Gud Key Prefix: Key sequence: C-x C-a
[ State ]: STANDARD.
Prefix of all GUD commands valid in C buffers.
Groups: [Gud]
It seems that all is working correctly, and nothing
needs to be fixed.
--
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52523
; Package
emacs
.
(Wed, 22 Dec 2021 12:42:01 GMT)
Full text and
rfc822 format available.
Message #38 received at 52523 <at> debbugs.gnu.org (full text, mbox):
Juri Linkov <juri <at> linkov.net> writes:
>> FWIW, I find the plural "keys" confusing, but other than that any of the
>> suggestions proposed so far are fine by me as well.
>
> I agree. OTOH, I still see no problem with 'kbd', or even 'kbd-sequence'.
The problem is that we don't use the name "kbd" anywhere in the new
keymap functions, so it'd be confusing to use them in defcustom.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52523
; Package
emacs
.
(Sun, 26 Dec 2021 16:41:01 GMT)
Full text and
rfc822 format available.
Message #41 received at 52523 <at> debbugs.gnu.org (full text, mbox):
Lars Ingebrigtsen <larsi <at> gnus.org> writes:
>> I still see no problem with 'kbd', or even 'kbd-sequence'.
>
> The problem is that we don't use the name "kbd" anywhere in the new
> keymap functions, so it'd be confusing to use them in defcustom.
I started looking into this but noticed that the docstring for
`key-valid-p' says:
Say whether KEYS is a valid ‘kbd’ sequence.
A ‘kbd’ sequence is a string consisting of one and more key
strokes. The key strokes are separated by a space character.
I guess that docstring should be updated if we don't want to settle for
the terminology "`kbd' sequence".
However, if we do that the problem is that we then risk having two
definitions of "key sequence": both the old and the new style.
See also (info "(elisp) Key Sequences"), that uses the old style.
---
Relatedly, the `define-keymap' docstring currently says:
Create a new keymap and define KEY/DEFINITION pairs as key sequences.
Should that say "key bindings" instead of "key sequences"? Otherwise,
it doesn't seem clear what it does.
---
`keymap-set' says:
Set key sequence KEY to DEFINITION in KEYMAP.
So here is again the "new" style used as the definition of a key
sequence, which seems to contradict the Elisp manual.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52523
; Package
emacs
.
(Mon, 27 Dec 2021 12:06:01 GMT)
Full text and
rfc822 format available.
Message #44 received at 52523 <at> debbugs.gnu.org (full text, mbox):
Stefan Kangas <stefan <at> marxist.se> writes:
> I started looking into this but noticed that the docstring for
> `key-valid-p' says:
>
> Say whether KEYS is a valid ‘kbd’ sequence.
> A ‘kbd’ sequence is a string consisting of one and more key
> strokes. The key strokes are separated by a space character.
>
> I guess that docstring should be updated if we don't want to settle for
> the terminology "`kbd' sequence".
Yes, I forgot to update the doc string when I redid this.
> However, if we do that the problem is that we then risk having two
> definitions of "key sequence": both the old and the new style.
>
> See also (info "(elisp) Key Sequences"), that uses the old style.
Yes, that's confusing. I meant to have the `key-valid-p' say what it
accepts as a valid key binding, and then the other functions refer to it.
> Relatedly, the `define-keymap' docstring currently says:
>
> Create a new keymap and define KEY/DEFINITION pairs as key sequences.
>
> Should that say "key bindings" instead of "key sequences"? Otherwise,
> it doesn't seem clear what it does.
Yes, it should.
> `keymap-set' says:
>
> Set key sequence KEY to DEFINITION in KEYMAP.
>
> So here is again the "new" style used as the definition of a key
> sequence, which seems to contradict the Elisp manual.
Yes. Please go ahead and fix up the doc strings. 😀
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52523
; Package
emacs
.
(Mon, 27 Dec 2021 15:42:02 GMT)
Full text and
rfc822 format available.
Message #47 received at 52523 <at> debbugs.gnu.org (full text, mbox):
Lars Ingebrigtsen <larsi <at> gnus.org> writes:
>> However, if we do that the problem is that we then risk having two
>> definitions of "key sequence": both the old and the new style.
>>
>> See also (info "(elisp) Key Sequences"), that uses the old style.
>
> Yes, that's confusing. I meant to have the `key-valid-p' say what it
> accepts as a valid key binding, and then the other functions refer to it.
Do you mean here "a valid key"? A key binding AFAIU is a mapping from
"KEY => DEFINITION" as described in `keymap-set-after', and belongs in a
key map.
>> `keymap-set' says:
>>
>> Set key sequence KEY to DEFINITION in KEYMAP.
>>
>> So here is again the "new" style used as the definition of a key
>> sequence, which seems to contradict the Elisp manual.
>
> Yes. Please go ahead and fix up the doc strings. 😀
I tried to do that on master (commit 8df3a71c52), please take a look.
I also filed a number of documentation bugs separately while looking
over the info manual.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52523
; Package
emacs
.
(Tue, 28 Dec 2021 03:09:02 GMT)
Full text and
rfc822 format available.
Message #50 received at 52523 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
tags 52523 + patch
thanks
Lars Ingebrigtsen <larsi <at> gnus.org> writes:
> The problem is that we don't use the name "kbd" anywhere in the new
> keymap functions, so it'd be confusing to use them in defcustom.
Having looked over the documentation to these functions, I actually
think "key" is the least confusing name here.
How does the attached patch look?
[0001-New-type-key-for-defcustom.patch (text/x-diff, attachment)]
Added tag(s) patch.
Request was from
Stefan Kangas <stefan <at> marxist.se>
to
control <at> debbugs.gnu.org
.
(Tue, 28 Dec 2021 03:09:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52523
; Package
emacs
.
(Tue, 28 Dec 2021 12:52:02 GMT)
Full text and
rfc822 format available.
Message #55 received at 52523 <at> debbugs.gnu.org (full text, mbox):
> From: Stefan Kangas <stefan <at> marxist.se>
> Date: Mon, 27 Dec 2021 19:08:42 -0800
> Cc: 52523 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
>
> Having looked over the documentation to these functions, I actually
> think "key" is the least confusing name here.
>
> How does the attached patch look?
>
>
> +@item key
> +The value is a valid key according to @kbd{key-valid-p}, and suitable
> +for use with, for example @code{keymap-set}.
But the doc string of key-valid-p says:
Say whether KEYS is a valid ‘kbd’ sequence.
A ‘kbd’ sequence is a string consisting of one and more key
strokes. The key strokes are separated by a space character.
So just referring to key-valid-p is not enough, because it accepts a
more general kind of objects.
> (define-widget 'key-sequence 'restricted-sexp
> - "A key sequence."
> + "A key sequence. Now obsolete; use the `key' type instead."
Please drop the "Now" part: it doesn't fare well with time. Instead,
say something like "This is obsolete; ...".
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52523
; Package
emacs
.
(Tue, 28 Dec 2021 14:33:02 GMT)
Full text and
rfc822 format available.
Message #58 received at 52523 <at> debbugs.gnu.org (full text, mbox):
Stefan Kangas <stefan <at> marxist.se> writes:
>> Yes, that's confusing. I meant to have the `key-valid-p' say what it
>> accepts as a valid key binding, and then the other functions refer to it.
>
> Do you mean here "a valid key"?
Yes.
> I tried to do that on master (commit 8df3a71c52), please take a look.
> I also filed a number of documentation bugs separately while looking
> over the info manual.
Looks good to me.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52523
; Package
emacs
.
(Tue, 28 Dec 2021 14:34:02 GMT)
Full text and
rfc822 format available.
Message #61 received at 52523 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
> But the doc string of key-valid-p says:
>
> Say whether KEYS is a valid ‘kbd’ sequence.
> A ‘kbd’ sequence is a string consisting of one and more key
> strokes. The key strokes are separated by a space character.
This has been changed now.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52523
; Package
emacs
.
(Tue, 28 Dec 2021 14:35:01 GMT)
Full text and
rfc822 format available.
Message #64 received at 52523 <at> debbugs.gnu.org (full text, mbox):
Stefan Kangas <stefan <at> marxist.se> writes:
> Having looked over the documentation to these functions, I actually
> think "key" is the least confusing name here.
>
> How does the attached patch look?
Other than the "Now obsolete" also noted by Eli, it looks good to me.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52523
; Package
emacs
.
(Sun, 02 Jan 2022 16:01:01 GMT)
Full text and
rfc822 format available.
Message #67 received at 52523 <at> debbugs.gnu.org (full text, mbox):
close 52523 29.1
thanks
Lars Ingebrigtsen <larsi <at> gnus.org> writes:
> Other than the "Now obsolete" also noted by Eli, it looks good to me.
Fixed that and pushed to master as commit 984391a9dc.
bug marked as fixed in version 29.1, send any further explanations to
52523 <at> debbugs.gnu.org and Stefan Kangas <stefan <at> marxist.se>
Request was from
Stefan Kangas <stefan <at> marxist.se>
to
control <at> debbugs.gnu.org
.
(Sun, 02 Jan 2022 16:01:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 31 Jan 2022 12:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 2 years and 86 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.