Subject: Re: bug#23425: master branch: `message' wrongly corrupts ' to curly quote.

From: Eli Zaretskii <[email-masked]>
Date: Tue, 03 May 2016 18:38:16 +0300

> Date: Mon, 2 May 2016 19:10:31 +0000
> From: Alan Mackenzie <[email-masked]>
> Cc: [email-masked]
> 
> Hello, Paul.

Hello, Alan.

First, I understand your frustration, and I'm sorry you lost time over
this issue.  This happens sometimes when new developments go against
our muscle memory.

Having said that...

> On Mon, May 02, 2016 at 10:53:59AM -0700, Paul Eggert wrote:
> > (message "%s" M) is the usual way to output a message M without 
> > formatting it, and something like this is needed anyway if M might 
> > contain %.
> 
> That is the case for a string that might contain percent characters.  It
> is not the case for a string known to be without percents.

It is now.  In general, the first argument of 'message' is not copied
to output verbatim, so the advice to use "%s" is a sound one.
Especially when you are going to display a string that is produced
dynamically, and so you don't have complete control on the result.
It's simply dangerous.  We just got one more use case in support of
that advice.

> There was nothing wrong with `c-replay-parse-state-state'; it used
> `message' as documented.  Your change implies that your workaround for
> `message''s problems is instead to write something like:
> 
>     (message "%s" (format "......." .....))
> 
> , which is ridiculous.

I don't see it as ridiculous.  You'd have similar problems (and use
the same solution) if the string produced by 'format' included %
characters, right?

>      In a format string containing single quotes, curved quotes `like
>      this' and grave quotes `like this' work better than straight
>      quotes 'like this', as `message' typically formats every straight
>      quote as a curved closing quote.
> [...]
> Why is there no clear definition of what is meant by the confusing terms
> "single quotes", "grave quotes", and "straight quotes"?

Not sure what you mean: AFAICT, the definition is right there in the
text you cited.

> Why is there no mention of `text-quoting-style' on this page?

Because we don't want to advertise it too much.  It is supposed to be
a kind of "fire escape", not something users must routinely do.  If
that assumption is wrong, then having this prominently mentioned in
the manual will be the least of our troubles.

> How do I configure my Emacs so that `message' behaves properly?

I urge you not to do that.  Because if you do, problems like this one
will slip unnoticed, instead of being fixed in the code.

> Properly, for me, means that it handles percent escape sequences, AND
> OTHERWISE LEAVES THE STRING UNCHANGED.  Why is this information not in
> the manual and the doc string?

AFAICT, 'grave' is that value.  And it is documented.

> > and the quoting change in Emacs 25 is documented in etc/NEWS, so it is 
> > not a bug per se.
> 
> Why is it not in the section "incompatible Lisp changes"?

Because it isn't.  If this is an incompatible change, then every new
features that changes behavior is also an incompatible change.

> How do I restore the old behaviour of `message'?

By setting text-quoting-style.  But again, please don't.

> Can we please fix this before Emacs 25.1 gets released?

What fix would you like to see?  I'm not sure I understand.

Thanks.