* bug#8935: 24.0.50; `substitute-command-keys' doc
@ 2011-06-25 21:29 Drew Adams
2011-07-15 14:32 ` Lars Magne Ingebrigtsen
2011-07-15 15:33 ` Andreas Schwab
0 siblings, 2 replies; 17+ messages in thread
From: Drew Adams @ 2011-06-25 21:29 UTC (permalink / raw)
To: 8935
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'
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#8935: 24.0.50; `substitute-command-keys' doc
2011-06-25 21:29 bug#8935: 24.0.50; `substitute-command-keys' doc Drew Adams
@ 2011-07-15 14:32 ` Lars Magne Ingebrigtsen
2011-07-15 15:33 ` Andreas Schwab
1 sibling, 0 replies; 17+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-07-15 14:32 UTC (permalink / raw)
To: Drew Adams; +Cc: 8935
"Drew Adams" <drew.adams@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/
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#8935: 24.0.50; `substitute-command-keys' doc
2011-06-25 21:29 bug#8935: 24.0.50; `substitute-command-keys' doc Drew Adams
2011-07-15 14:32 ` Lars Magne Ingebrigtsen
@ 2011-07-15 15:33 ` Andreas Schwab
2011-07-15 16:00 ` Drew Adams
` (3 more replies)
1 sibling, 4 replies; 17+ messages in thread
From: Andreas Schwab @ 2011-07-15 15:33 UTC (permalink / raw)
To: Drew Adams; +Cc: 8935
"Drew Adams" <drew.adams@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@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#8935: 24.0.50; `substitute-command-keys' doc
2011-07-15 15:33 ` Andreas Schwab
@ 2011-07-15 16:00 ` Drew Adams
2011-07-15 16:35 ` Lars Magne Ingebrigtsen
` (2 subsequent siblings)
3 siblings, 0 replies; 17+ messages in thread
From: Drew Adams @ 2011-07-15 16:00 UTC (permalink / raw)
To: 'Andreas Schwab'; +Cc: 8935
> > 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.
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#8935: 24.0.50; `substitute-command-keys' doc
2011-07-15 15:33 ` Andreas Schwab
2011-07-15 16:00 ` Drew Adams
@ 2011-07-15 16:35 ` Lars Magne Ingebrigtsen
2011-07-15 16:35 ` Lars Magne Ingebrigtsen
2011-07-18 13:55 ` Stefan Monnier
3 siblings, 0 replies; 17+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-07-15 16:35 UTC (permalink / raw)
To: 8935
Andreas Schwab <schwab@linux-m68k.org> writes:
> "Drew Adams" <drew.adams@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/
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#8935: 24.0.50; `substitute-command-keys' doc
2011-07-15 15:33 ` Andreas Schwab
2011-07-15 16:00 ` Drew Adams
2011-07-15 16:35 ` Lars Magne Ingebrigtsen
@ 2011-07-15 16:35 ` Lars Magne Ingebrigtsen
2011-07-15 17:23 ` Drew Adams
2011-07-18 13:55 ` Stefan Monnier
3 siblings, 1 reply; 17+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-07-15 16:35 UTC (permalink / raw)
To: Andreas Schwab; +Cc: 8935
Andreas Schwab <schwab@linux-m68k.org> writes:
> "Drew Adams" <drew.adams@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/
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#8935: 24.0.50; `substitute-command-keys' doc
2011-07-15 16:35 ` Lars Magne Ingebrigtsen
@ 2011-07-15 17:23 ` Drew Adams
2011-07-15 17:28 ` Lars Magne Ingebrigtsen
0 siblings, 1 reply; 17+ messages in thread
From: Drew Adams @ 2011-07-15 17:23 UTC (permalink / raw)
To: 'Lars Magne Ingebrigtsen', 'Andreas Schwab'; +Cc: 8935
> > 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.
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#8935: 24.0.50; `substitute-command-keys' doc
2011-07-15 17:23 ` Drew Adams
@ 2011-07-15 17:28 ` Lars Magne Ingebrigtsen
2011-07-15 18:38 ` Andreas Schwab
2011-07-15 19:18 ` Drew Adams
0 siblings, 2 replies; 17+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-07-15 17:28 UTC (permalink / raw)
To: Drew Adams; +Cc: 8935, 'Andreas Schwab'
"Drew Adams" <drew.adams@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/
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#8935: 24.0.50; `substitute-command-keys' doc
2011-07-15 17:28 ` Lars Magne Ingebrigtsen
@ 2011-07-15 18:38 ` Andreas Schwab
2011-07-15 19:17 ` Drew Adams
2011-07-15 19:18 ` Drew Adams
1 sibling, 1 reply; 17+ messages in thread
From: Andreas Schwab @ 2011-07-15 18:38 UTC (permalink / raw)
To: Lars Magne Ingebrigtsen; +Cc: 8935
Lars Magne Ingebrigtsen <larsi@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@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#8935: 24.0.50; `substitute-command-keys' doc
2011-07-15 18:38 ` Andreas Schwab
@ 2011-07-15 19:17 ` Drew Adams
2011-07-15 20:09 ` Andreas Schwab
0 siblings, 1 reply; 17+ messages in thread
From: Drew Adams @ 2011-07-15 19:17 UTC (permalink / raw)
To: 'Andreas Schwab', 'Lars Magne Ingebrigtsen'; +Cc: 8935
> > "\=\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.
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#8935: 24.0.50; `substitute-command-keys' doc
2011-07-15 17:28 ` Lars Magne Ingebrigtsen
2011-07-15 18:38 ` Andreas Schwab
@ 2011-07-15 19:18 ` Drew Adams
2011-07-15 19:22 ` Lars Magne Ingebrigtsen
1 sibling, 1 reply; 17+ messages in thread
From: Drew Adams @ 2011-07-15 19:18 UTC (permalink / raw)
To: 'Lars Magne Ingebrigtsen'; +Cc: 8935, 'Andreas Schwab'
> > 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.
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#8935: 24.0.50; `substitute-command-keys' doc
2011-07-15 19:18 ` Drew Adams
@ 2011-07-15 19:22 ` Lars Magne Ingebrigtsen
2011-07-15 19:25 ` Drew Adams
0 siblings, 1 reply; 17+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-07-15 19:22 UTC (permalink / raw)
To: Drew Adams; +Cc: 8935, 'Andreas Schwab'
"Drew Adams" <drew.adams@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/
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#8935: 24.0.50; `substitute-command-keys' doc
2011-07-15 19:22 ` Lars Magne Ingebrigtsen
@ 2011-07-15 19:25 ` Drew Adams
0 siblings, 0 replies; 17+ messages in thread
From: Drew Adams @ 2011-07-15 19:25 UTC (permalink / raw)
To: 'Lars Magne Ingebrigtsen'; +Cc: 8935, 'Andreas Schwab'
> > Dunno what it was.
>
> You don't read the emacs-diffs mailing list? :-)
Nope. Sorry.
> I implemented what you described.
Thank you.
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#8935: 24.0.50; `substitute-command-keys' doc
2011-07-15 19:17 ` Drew Adams
@ 2011-07-15 20:09 ` Andreas Schwab
0 siblings, 0 replies; 17+ messages in thread
From: Andreas Schwab @ 2011-07-15 20:09 UTC (permalink / raw)
To: Drew Adams; +Cc: 'Lars Magne Ingebrigtsen', 8935
"Drew Adams" <drew.adams@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@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#8935: 24.0.50; `substitute-command-keys' doc
2011-07-15 15:33 ` Andreas Schwab
` (2 preceding siblings ...)
2011-07-15 16:35 ` Lars Magne Ingebrigtsen
@ 2011-07-18 13:55 ` Stefan Monnier
2011-07-18 14:27 ` Andreas Schwab
3 siblings, 1 reply; 17+ messages in thread
From: Stefan Monnier @ 2011-07-18 13:55 UTC (permalink / raw)
To: Andreas Schwab; +Cc: 8935
>> 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
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#8935: 24.0.50; `substitute-command-keys' doc
2011-07-18 13:55 ` Stefan Monnier
@ 2011-07-18 14:27 ` Andreas Schwab
2011-07-18 16:20 ` Stefan Monnier
0 siblings, 1 reply; 17+ messages in thread
From: Andreas Schwab @ 2011-07-18 14:27 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 8935
Stefan Monnier <monnier@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@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#8935: 24.0.50; `substitute-command-keys' doc
2011-07-18 14:27 ` Andreas Schwab
@ 2011-07-18 16:20 ` Stefan Monnier
0 siblings, 0 replies; 17+ messages in thread
From: Stefan Monnier @ 2011-07-18 16:20 UTC (permalink / raw)
To: Andreas Schwab; +Cc: 8935
>> 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
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2011-07-18 16:20 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-25 21:29 bug#8935: 24.0.50; `substitute-command-keys' doc Drew Adams
2011-07-15 14:32 ` Lars Magne Ingebrigtsen
2011-07-15 15:33 ` Andreas Schwab
2011-07-15 16:00 ` Drew Adams
2011-07-15 16:35 ` Lars Magne Ingebrigtsen
2011-07-15 16:35 ` Lars Magne Ingebrigtsen
2011-07-15 17:23 ` Drew Adams
2011-07-15 17:28 ` Lars Magne Ingebrigtsen
2011-07-15 18:38 ` Andreas Schwab
2011-07-15 19:17 ` Drew Adams
2011-07-15 20:09 ` Andreas Schwab
2011-07-15 19:18 ` Drew Adams
2011-07-15 19:22 ` Lars Magne Ingebrigtsen
2011-07-15 19:25 ` Drew Adams
2011-07-18 13:55 ` Stefan Monnier
2011-07-18 14:27 ` Andreas Schwab
2011-07-18 16:20 ` Stefan Monnier
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.