GNU bug report logs -
#8935
24.0.50; `substitute-command-keys' doc
Previous Next
Reported by: "Drew Adams" <drew.adams <at> oracle.com>
Date: Sat, 25 Jun 2011 21:30:04 UTC
Severity: minor
Tags: fixed
Found in version 24.0.50
Fixed in version 24.1
Done: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
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 8935 in the body.
You can then email your comments to 8935 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#8935
; Package
emacs
.
(Sat, 25 Jun 2011 21:30:04 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
"Drew Adams" <drew.adams <at> oracle.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sat, 25 Jun 2011 21:30:05 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Both the doc string and the doc in the Elisp manual (node `Keys in
Documentation') are unnecessarily confusing wrt `\='.
They both correctly say that `\=' "quotes the following character and is
discarded". However, they then say this to illustrate what is meant:
"thus, `\=\[' puts `\[' into the output, and `\=\=' puts
`\=' into the output."
This is uncessarily complex and misleading. All the `\=' does is
quote/escape the (single) next character, whatever it is. Nothing
more.
It has no special effect on special character combinations such as `\['
and `\='. If you really want to say something about escaping `\' as
the next character then I suppose you could: "In particular, `\=\'
produces `\' in the output. The character following the escaped
character does not enter into (i.e., affect) the behavior at all.
In GNU Emacs 24.0.50.1 (i386-mingw-nt5.1.2600)
of 2011-06-20 on 3249CTO
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (4.5) --no-opt --cflags
-Ic:/build/include'
Added tag(s) fixed.
Request was from
Lars Magne Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Fri, 15 Jul 2011 14:33:02 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 24.1, send any further explanations to
8935 <at> debbugs.gnu.org and "Drew Adams" <drew.adams <at> oracle.com>
Request was from
Lars Magne Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Fri, 15 Jul 2011 14:33:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#8935
; Package
emacs
.
(Fri, 15 Jul 2011 14:35:04 GMT)
Full text and
rfc822 format available.
Message #12 received at 8935 <at> debbugs.gnu.org (full text, mbox):
"Drew Adams" <drew.adams <at> oracle.com> writes:
> It has no special effect on special character combinations such as `\['
> and `\='. If you really want to say something about escaping `\' as
> the next character then I suppose you could: "In particular, `\=\'
> produces `\' in the output. The character following the escaped
> character does not enter into (i.e., affect) the behavior at all.
I've now done this.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog http://lars.ingebrigtsen.no/
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#8935
; Package
emacs
.
(Fri, 15 Jul 2011 15:35:01 GMT)
Full text and
rfc822 format available.
Message #15 received at 8935 <at> debbugs.gnu.org (full text, mbox):
"Drew Adams" <drew.adams <at> oracle.com> writes:
> It has no special effect on special character combinations such as `\['
> and `\='. If you really want to say something about escaping `\' as
> the next character then I suppose you could: "In particular, `\=\'
> produces `\' in the output.
This is wrong, because \ by itself has no special meaning, so you don't
need to precede it by \=.
Andreas.
--
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#8935
; Package
emacs
.
(Fri, 15 Jul 2011 16:01:01 GMT)
Full text and
rfc822 format available.
Message #18 received at 8935 <at> debbugs.gnu.org (full text, mbox):
> > It has no special effect on special character combinations
> > such as `\[' and `\='. If you really want to say something
> > about escaping `\' as the next character then I suppose you
> > could: "In particular, `\=\' produces `\' in the output.
>
> This is wrong, because \ by itself has no special meaning, so
> you don't need to precede it by \=.
It's not wrong. \ by itself has no special meaning, so it need not be escaped
when by itself - agreed.
But \ followed by these particular chars (e.g. `[') does have special meaning
for `substitute-command-keys', so when followed by such a char it does need to
be escaped, if you want `\' in the output.
It is nevertheless the \ and only the \ that is escaped. The escaping code
takes no look past the \ to see what follows it. It is you, the programmer, who
decides whether a particular \ needs escaping, and yes, you do that by looking
at the following char (e.g. `[').
But _you_ do that - that is not part of what `substitute-command-keys' does or
`\=' does.
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#8935
; Package
emacs
.
(Fri, 15 Jul 2011 16:36:02 GMT)
Full text and
rfc822 format available.
Message #21 received at submit <at> debbugs.gnu.org (full text, mbox):
Andreas Schwab <schwab <at> linux-m68k.org> writes:
> "Drew Adams" <drew.adams <at> oracle.com> writes:
>
>> It has no special effect on special character combinations such as `\['
>> and `\='. If you really want to say something about escaping `\' as
>> the next character then I suppose you could: "In particular, `\=\'
>> produces `\' in the output.
>
> This is wrong, because \ by itself has no special meaning, so you don't
> need to precede it by \=.
I see. I thought it worked the normal way, in that "\e" would be "e".
Thanks for correcting this. Did you do the manual, too? If not I can
take care of that.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog http://lars.ingebrigtsen.no/
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#8935
; Package
emacs
.
(Fri, 15 Jul 2011 16:37:01 GMT)
Full text and
rfc822 format available.
Message #24 received at 8935 <at> debbugs.gnu.org (full text, mbox):
Andreas Schwab <schwab <at> linux-m68k.org> writes:
> "Drew Adams" <drew.adams <at> oracle.com> writes:
>
>> It has no special effect on special character combinations such as `\['
>> and `\='. If you really want to say something about escaping `\' as
>> the next character then I suppose you could: "In particular, `\=\'
>> produces `\' in the output.
>
> This is wrong, because \ by itself has no special meaning, so you don't
> need to precede it by \=.
I see. I thought it worked the normal way, in that "\e" would be "e".
Thanks for correcting this. Did you do the manual, too? If not I can
take care of that.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog http://lars.ingebrigtsen.no/
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#8935
; Package
emacs
.
(Fri, 15 Jul 2011 17:24:02 GMT)
Full text and
rfc822 format available.
Message #27 received at 8935 <at> debbugs.gnu.org (full text, mbox):
> > This is wrong, because \ by itself has no special meaning,
> > so you don't need to precede it by \=.
>
> I see. I thought it worked the normal way, in that "\e" would be "e".
It does. That is correct.
Andreas was wrong in saying it is wrong.
What is true is that \ by itself (not followed by [, =, etc.) does not _NEED_ to
be escaped. But it is certainly true that \= escapes \, whether it needs to in
any given context (e.g. \[) or not (e.g. \ abc). If it escapes a \ that does
not need escaping, the effect is a no-op.
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#8935
; Package
emacs
.
(Fri, 15 Jul 2011 17:29:02 GMT)
Full text and
rfc822 format available.
Message #30 received at 8935 <at> debbugs.gnu.org (full text, mbox):
"Drew Adams" <drew.adams <at> oracle.com> writes:
> What is true is that \ by itself (not followed by [, =, etc.) does not
> _NEED_ to be escaped. But it is certainly true that \= escapes \,
> whether it needs to in any given context (e.g. \[) or not (e.g. \
> abc). If it escapes a \ that does not need escaping, the effect is a
> no-op.
Uhm. Now I'm even more confused.
"\=\e" will print as "\e"? Right? So it's not a noop, and the fix I
applied was correct.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog http://lars.ingebrigtsen.no/
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#8935
; Package
emacs
.
(Fri, 15 Jul 2011 18:39:01 GMT)
Full text and
rfc822 format available.
Message #33 received at 8935 <at> debbugs.gnu.org (full text, mbox):
Lars Magne Ingebrigtsen <larsi <at> gnus.org> writes:
> "\=\e" will print as "\e"? Right? So it's not a noop, and the fix I
> applied was correct.
No. The *only* special sequences processed by substitute-command-keys'
are '\=', '\[', '\<' and '\{'. Nothing else. The sentence is about how
to write these special sequences in the doc string so that they are not
treated specially, so the examples should talk about '\=' and '\[', not
about '\'.
Andreas.
--
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#8935
; Package
emacs
.
(Fri, 15 Jul 2011 19:19:01 GMT)
Full text and
rfc822 format available.
Message #36 received at 8935 <at> debbugs.gnu.org (full text, mbox):
> > "\=\e" will print as "\e"? Right? So it's not a noop, and the fix I
> > applied was correct.
>
> No. The *only* special sequences processed by
> substitute-command-keys' are '\=', '\[', '\<' and '\{'.
> Nothing else.
Correct.
> The sentence is about how to write these special sequences in
> the doc string so that they are not treated specially,
Correct.
> so the examples should talk about '\=' and '\[', not about '\'.
It's OK to mention that in "\=\[" the \= escapes the \ so that \[ appears in the
output. But it is only the \ that is being escaped here.
Escaping a character means making it act normally, not specially. Only the \
acts specially, and it does so only when it precedes [, {, etc.
So yes, this escaping of \ only has an effect when the \ precedes [, {, etc.
But strictly speaking it is only the \ that gets escaped in these contexts. The
=, [, etc. does not need to be escaped because those are not treated specially
unless preceded by an unescaped \. So only one character needs to be escaped:
the \.
Anyway, it's a minor point (bug). I really don't care what you do with it.
When I read the doc string, I found it confusing. I looked at the code and
understood. It is _enough_ to say that \= escapes a \, preventing it from
introducing a substitution when followed by =, [, etc.
Or as I said in the beginning:
> This is uncessarily complex and misleading. All the `\=' does is
> quote/escape the (single) next character, whatever it is. Nothing
> more.
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#8935
; Package
emacs
.
(Fri, 15 Jul 2011 19:20:02 GMT)
Full text and
rfc822 format available.
Message #39 received at 8935 <at> debbugs.gnu.org (full text, mbox):
> > What is true is that \ by itself (not followed by [, =,
> > etc.) does not _NEED_ to be escaped. But it is certainly true
> > that \= escapes \, whether it needs to in any given context
> > (e.g. \[) or not (e.g. \abc). If it escapes a \ that does not
> > need escaping, the effect is a no-op.
>
> Uhm. Now I'm even more confused.
>
> "\=\e" will print as "\e"? Right?
Right.
> So it's not a noop,
It's a no-op in the sense that it does nothing. Of course, it is still the case
that, as the doc string says, the \= itself "is discarded". What remains is the
\ that was escaped.
Not sure what your confusion is. \= escapes the char that follows it. What
does escaping mean in this context? Preventing \ from having any special
behavior when it precedes =, [, etc.
The point is that it is not the pair of characters \=, \[, etc. that is escaped.
\ is the only char escaped: it is prevented from doing anything special; it just
appears in the output as is. Because \ gets escaped, it has no special
`substitute-command-keys' effect on what follows it, whatever that might be.
> and the fix I applied was correct.
Dunno what it was.
What I described is a proper fix, IMO.
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#8935
; Package
emacs
.
(Fri, 15 Jul 2011 19:23:02 GMT)
Full text and
rfc822 format available.
Message #42 received at 8935 <at> debbugs.gnu.org (full text, mbox):
"Drew Adams" <drew.adams <at> oracle.com> writes:
>> and the fix I applied was correct.
>
> Dunno what it was.
>
> What I described is a proper fix, IMO.
You don't read the emacs-diffs mailing list? :-)
I implemented what you described.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog http://lars.ingebrigtsen.no/
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#8935
; Package
emacs
.
(Fri, 15 Jul 2011 19:26:02 GMT)
Full text and
rfc822 format available.
Message #45 received at 8935 <at> debbugs.gnu.org (full text, mbox):
> > Dunno what it was.
>
> You don't read the emacs-diffs mailing list? :-)
Nope. Sorry.
> I implemented what you described.
Thank you.
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#8935
; Package
emacs
.
(Fri, 15 Jul 2011 20:10:03 GMT)
Full text and
rfc822 format available.
Message #48 received at 8935 <at> debbugs.gnu.org (full text, mbox):
"Drew Adams" <drew.adams <at> oracle.com> writes:
> Escaping a character means making it act normally, not specially. Only the \
> acts specially,
Wrong.
> and it does so only when it precedes [, {, etc.
Right. And only this is of interest.
> It is _enough_ to say that \= escapes a \, preventing it from
> introducing a substitution when followed by =, [, etc.
No, this is the wrong thing to do. The doc string should say how to
produce a value that contains the two character sequences '\=' or '\['.
That's the *whole* point of the examples (and these are *examples*, not
specification).
You don't need '\=' to produce a backslash in the value. So that is
useless to say so.
A doc string needs to get to the point, not be technically correct.
Andreas.
--
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#8935
; Package
emacs
.
(Mon, 18 Jul 2011 13:56:02 GMT)
Full text and
rfc822 format available.
Message #51 received at 8935 <at> debbugs.gnu.org (full text, mbox):
>> It has no special effect on special character combinations such as `\['
>> and `\='. If you really want to say something about escaping `\' as
>> the next character then I suppose you could: "In particular, `\=\'
>> produces `\' in the output.
> This is wrong, because \ by itself has no special meaning, so you don't
> need to precede it by \=.
Actually \ does have a special meaning, which depends on the following
char (just like \ in regexps). The difference between that and regexps
is that in regexp \<char> turns into just <char> when \<char> has no
special meaning, where it turns into \<char> here.
Stefan
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#8935
; Package
emacs
.
(Mon, 18 Jul 2011 14:28:02 GMT)
Full text and
rfc822 format available.
Message #54 received at 8935 <at> debbugs.gnu.org (full text, mbox):
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
> Actually \ does have a special meaning, which depends on the following
> char (just like \ in regexps). The difference between that and regexps
> is that in regexp \<char> turns into just <char> when \<char> has no
> special meaning, where it turns into \<char> here.
If you want a \ in a regexp you must write \\, always. But if you want
to have a \ from substitute-command-keys you just write \, and if you
want \\= you must write \\=\=. Thus \ by itself is not special here.
Andreas.
--
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#8935
; Package
emacs
.
(Mon, 18 Jul 2011 16:21:02 GMT)
Full text and
rfc822 format available.
Message #57 received at 8935 <at> debbugs.gnu.org (full text, mbox):
>> Actually \ does have a special meaning, which depends on the following
>> char (just like \ in regexps). The difference between that and regexps
>> is that in regexp \<char> turns into just <char> when \<char> has no
>> special meaning, where it turns into \<char> here.
> If you want a \ in a regexp you must write \\, always. But if you want
> to have a \ from substitute-command-keys you just write \, and if you
> want \\= you must write \\=\=. Thus \ by itself is not special here.
The "by itself" doesn't mean much, and \ is special because it changes
the meaning of the subsequent character. I agree it's not special in
the same way as it is in regexps, but it is still special.
Stefan
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 16 Aug 2011 11:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 14 years and 25 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.