GNU bug report logs -
#50804
Command substitutions for keys without keymaps
Previous Next
Reported by: Stefan Kangas <stefan <at> marxist.se>
Date: Sat, 25 Sep 2021 18:02:01 UTC
Severity: wishlist
Tags: patch
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 50804 in the body.
You can then email your comments to 50804 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#50804
; Package
emacs
.
(Sat, 25 Sep 2021 18:02:01 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
.
(Sat, 25 Sep 2021 18:02:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Severity: wishlist
We have "\\[foo]" command substitutions in `substitute-command-keys'.
This also puts the face help-key-binding on the replaced text, which
makes key bindings stand out more clearly.
We don't always have a keymap to refer to, because the keys are read
through `read-key' or similar.
For example, in ispell.el:
(message (concat "C-h or ? for more options; SPC to leave "
"unchanged, Character to replace word")))
In other cases, we have the same situation in a docstring, for example
in `isearch-lax-whitespace'.
It would be nice if we could have some way of putting a face on such key
bindings, without having to fiddle with propertize. For example:
(message (substitute-command-keys
(concat "\\[[C-h]] or \\[[?]] for more options;
\\[[SPC]] to leave "
"unchanged, Character to replace word"))))
I'm not sure about the notation. Perhaps "\\[[...]]" is okay, or
perhaps we want some other delimiter.
And perhaps we would want support for this notation also in
`format-messages'? I'm not sure, but I'm putting it out there.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50804
; Package
emacs
.
(Sun, 26 Sep 2021 06:59:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 50804 <at> debbugs.gnu.org (full text, mbox):
Stefan Kangas <stefan <at> marxist.se> writes:
> It would be nice if we could have some way of putting a face on such key
> bindings, without having to fiddle with propertize. For example:
>
> (message (substitute-command-keys
> (concat "\\[[C-h]] or \\[[?]] for more options;
> \\[[SPC]] to leave "
> "unchanged, Character to replace word"))))
Makes sense to me.
> I'm not sure about the notation. Perhaps "\\[[...]]" is okay, or
> perhaps we want some other delimiter.
What about... \\`C-h'
Hm. Possibly too confusing.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50804
; Package
emacs
.
(Tue, 28 Sep 2021 00:42:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 50804 <at> debbugs.gnu.org (full text, mbox):
Lars Ingebrigtsen <larsi <at> gnus.org> writes:
>> I'm not sure about the notation. Perhaps "\\[[...]]" is okay, or
>> perhaps we want some other delimiter.
>
> What about... \\`C-h'
>
> Hm. Possibly too confusing.
Using some other delimiters than "\\[]" would probably be nice though,
because:
(substitute-command-keys "\\[[C-h]]")
=> "M-x [C-h]"
(substitute-command-keys "\\`C-h`")
=> "\\‘C-h‘"
The second one will be printed as "\‘C-h‘" on old versions, which isn't
perfect but not too bad. Even if the extra "\" is distracting, it is at
least not actively misleading...
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50804
; Package
emacs
.
(Tue, 28 Sep 2021 05:28:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 50804 <at> debbugs.gnu.org (full text, mbox):
Stefan Kangas <stefan <at> marxist.se> writes:
> The second one will be printed as "\‘C-h‘" on old versions, which isn't
> perfect but not too bad. Even if the extra "\" is distracting, it is at
> least not actively misleading...
That's a good point. So perhaps \\`C-h' does make sense in
`substitute-command-keys'.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50804
; Package
emacs
.
(Sat, 20 Nov 2021 15:07:01 GMT)
Full text and
rfc822 format available.
Message #17 received at 50804 <at> debbugs.gnu.org (full text, mbox):
Lars Ingebrigtsen <larsi <at> gnus.org> writes:
> Stefan Kangas <stefan <at> marxist.se> writes:
>
>> The second one will be printed as "\‘C-h‘" on old versions, which isn't
>> perfect but not too bad. Even if the extra "\" is distracting, it is at
>> least not actively misleading...
>
> That's a good point. So perhaps \\`C-h' does make sense in
> `substitute-command-keys'.
I found a patch of mine from March that I had forgotten about. It uses
the syntax "\\[=y]" to mean the key "y" where, I guess, we could
stipulate that whatever comes after "=" is `key-valid-p'.
However, it breaks backwards incompatibility just as "\\[[y]]" would:
(substitute-command-keys "\\[=k]")
=> "M-x =k"
(substitute-command-keys "\\[[y]]")
=> "M-x [y]"
Which is just... wrong. So either we say that, you know, don't use this
syntax in code intended for use in anything older Emacs 29, or we just
go with the new syntax \\`y`.
Given that I have a seemingly mostly working patch it should be easy to
fix it up whichever way we decide to go. I hope.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50804
; Package
emacs
.
(Sun, 21 Nov 2021 08:27:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 50804 <at> debbugs.gnu.org (full text, mbox):
Stefan Kangas <stefan <at> marxist.se> writes:
> Which is just... wrong. So either we say that, you know, don't use this
> syntax in code intended for use in anything older Emacs 29, or we just
> go with the new syntax \\`y`.
I'd be OK to go with the new syntax here.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50804
; Package
emacs
.
(Sun, 21 Nov 2021 13:37:01 GMT)
Full text and
rfc822 format available.
Message #23 received at 50804 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
tags 50804 + patch
thanks
Lars Ingebrigtsen <larsi <at> gnus.org> writes:
> I'd be OK to go with the new syntax here.
Maybe something like the attached?
[0001-Add-new-format-for-literal-key-sequences-to-substitu.patch (text/x-diff, attachment)]
Added tag(s) patch.
Request was from
Stefan Kangas <stefan <at> marxist.se>
to
control <at> debbugs.gnu.org
.
(Sun, 21 Nov 2021 13:37:01 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50804
; Package
emacs
.
(Sun, 21 Nov 2021 19:57:01 GMT)
Full text and
rfc822 format available.
Message #28 received at 50804 <at> debbugs.gnu.org (full text, mbox):
Stefan Kangas <stefan <at> marxist.se> writes:
> Maybe something like the attached?
Makes sense 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#50804
; Package
emacs
.
(Mon, 22 Nov 2021 05:49:01 GMT)
Full text and
rfc822 format available.
Message #31 received at 50804 <at> debbugs.gnu.org (full text, mbox):
close 50804 29.1
thanks
Lars Ingebrigtsen <larsi <at> gnus.org> writes:
> Makes sense to me.
Thanks, pushed (commit 1aef1a6673).
bug marked as fixed in version 29.1, send any further explanations to
50804 <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
.
(Mon, 22 Nov 2021 05:49:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50804
; Package
emacs
.
(Mon, 22 Nov 2021 15:11:02 GMT)
Full text and
rfc822 format available.
Message #36 received at 50804 <at> debbugs.gnu.org (full text, mbox):
> From: Stefan Kangas <stefan <at> marxist.se>
> Date: Mon, 22 Nov 2021 06:48:29 +0100
> Cc: 50804 <at> debbugs.gnu.org
>
> Lars Ingebrigtsen <larsi <at> gnus.org> writes:
>
> > Makes sense to me.
>
> Thanks, pushed (commit 1aef1a6673).
The NEWS entry says:
** New substitution in docstrings and 'substitute-command-keys'.
Use "\\`KEYSEQ'" to insert a literal key sequence "KEYSEQ"
(e.g. "C-k") in a docstring or when calling 'substitute-command-keys',
Shouldn't that be "\\`C-k" instead?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50804
; Package
emacs
.
(Mon, 22 Nov 2021 15:16:02 GMT)
Full text and
rfc822 format available.
Message #39 received at 50804 <at> debbugs.gnu.org (full text, mbox):
> Date: Mon, 22 Nov 2021 17:10:13 +0200
> From: Eli Zaretskii <eliz <at> gnu.org>
> Cc: larsi <at> gnus.org, 50804 <at> debbugs.gnu.org
>
> ** New substitution in docstrings and 'substitute-command-keys'.
> Use "\\`KEYSEQ'" to insert a literal key sequence "KEYSEQ"
> (e.g. "C-k") in a docstring or when calling 'substitute-command-keys',
>
> Shouldn't that be "\\`C-k" instead?
Actually, it should be "\\`C-k'", right? (And I'd drop the outer
quotes, as they muddy the waters.)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50804
; Package
emacs
.
(Mon, 22 Nov 2021 15:30:02 GMT)
Full text and
rfc822 format available.
Message #42 received at 50804 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
> > ** New substitution in docstrings and 'substitute-command-keys'.
> > Use "\\`KEYSEQ'" to insert a literal key sequence "KEYSEQ"
> > (e.g. "C-k") in a docstring or when calling 'substitute-command-keys',
> >
> > Shouldn't that be "\\`C-k" instead?
>
> Actually, it should be "\\`C-k'", right? (And I'd drop the outer
> quotes, as they muddy the waters.)
Yup, that's better, thanks. Now fixed on master.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 21 Dec 2021 12:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 2 years and 119 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.