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

From: Paul Eggert <[email-masked]>
Date: Sun, 4 Jun 2017 14:01:42 -0700

Alan Mackenzie wrote:

> We have moved from a state where everybody knew what
> `message' did (in Emacs 24), to one with wild special characters which
> only apply sometimes, and necessitate crazy prolix formulations to work
> around unwanted translations of quote characters.

This exaggerates somewhat. We moved from Emacs 24 where only % is special, to 
Emacs 25 where %, ` and ' are special. Although some people don't know that ` 
and ' are special, that's also true for %. And although it can be annoying to 
write (message "%s" STR) to avoid unwanted translation of STR, that annoyance 
was already present for %.

> it makes sense to shift this burden over to the use cases where the
> programmers need quote translation, and hence will be aware of it.
When text-quoting-style specifies translation, most instances of ` and ' in 
Emacs messages are better off translated. So it also makes sense to translate by 
default in this situation, with a way to avoid translation in the rare cases 
where translation isn't wanted. The question is about which approach makes more 
sense, not whether one approach is sensible and the other nonsense.

>> although it simplifies ‘message’ (obviously), this is at the price of
>> complicating everything else.
> 
> What is the "everything else" that gets thus complicated?

I was referring to the hassle of going through hundreds or thousands of message 
strings or calls, deciding which instances of ` and ' should be replaced with %` 
and %', and replacing the instances accordingly. It's also possible that at 
times we'll need two format strings instead of one, complicating the code.

> There are around 17,000
> occurrances of "message" in our Lisp sources, and probably a few in our
> C sources.  Only (some of) those containing the quote characters in the
> format string would need amendment.  These will comprise a tiny portion
> of these ~17,000

How many lines do you think will be in that "tiny portion"? No matter how you 
count them, it'll be quite a few changes.

> and can be found easily enough with a script

I'm afraid not, because in many cases the string is not a simple literal 
constant argument to the message function. For starters, there's also the error 
function; that's another 14,000 text matches in the Elisp source -- many of them 
false alarms of course, but not all of them.

I'm not saying this sort of change is impossible. It's just that it'd be quite a 
bit of work, work that someone would need to volunteer to do. Is this really the 
best use of our limited resources?