Subject: bug#20707: [PROPOSED PATCH] Use curved quoting in C-generated errors

From: Alan Mackenzie <[email-masked]>
Date: Wed, 10 Jun 2015 19:17:30 +0000

Hello, Paul.

On Wed, Jun 10, 2015 at 09:20:26AM -0700, Paul Eggert wrote:
> Alan Mackenzie wrote:

> > You want to
> > promote difficult-to-type and problematic-to-display characters to the
> > status of standard "working characters".

> The problems aren't that serious.  Display problems are limited to obsolete 
> environments that hardly anybody uses ....

Is that right?  How many people is that, then?  The answer is you haven't
a clue.  You haven't even a clue how many people in total use Emacs.
None of us has, and neither has anybody else.

It seems to me, judging by the number of questions relating to Emacs on
the Linux console I've answered over the years, the number of users is
not small.  And "obsolete" these environments are not.  They're useful,
and they're used.

> ... because they're so awful, ...

Actually, I happen rather to like them.  I believe RMS does, too.  There
are several advantages the console has over a GUI, even assuming both are
available (which they aren't always).  Logically, if you're doing pure
text work, a GUI is going to have lots of irrelevant graphicsy things
which are just going to get in the way.  One example is window managers
taking M-<tab> away from Emacs.  Yes, I know there are workarounds for
this.

> ... and even there we have workarounds.

Workarounds are by their very nature second rate.  As competent hackers,
we should be finding solutions rather than workarounds.

> And typing problems aren't a big deal in my Emacs environment: for left
> and right single quotes I normally type a single keystroke, without any
> control or shift or meta keys.  (This is because I use Electric Quote
> mode.)  Other typing environments are also available that work nearly
> as well (using Alt-[ and Alt-] for the two characters, if your Alt key
> works).

It doesn't.  Last time I checked, the Alt key wasn't in use at all in
standard Emacs.  It would be easy enough to introduce an Alt in
GNU/Linux, there's no shortage of silly keys around, but it would be more
problematic in MS-Windows, where the silly keys are already in use.

And things like Electric Quote mode will only work inside Emacs.  But
we've talked about that before.

> I'm not expecting everyone to use these keyboard methods right away.
> There will be a transition period, and perhaps other, better methods of
> dealing this will emerge.  However, there should be no obstacle to
> people who do want to use those methods.

> > I have a feeling you're intending to argue for making the use of curly
> > quotes in our Lisp files standard.

> Yes, of course.  It should be normal to type quotes as themselves in doc 
> strings.  It's basic WYSIWYG.

My entire argument over the last several posts has been about upholding
WYSIWYG.

> > Anyway, here's another idea for making curly quotes in lisp code
> > optional: an escaped 0x27 or 0x60 in a string should be translated by the
> > reader to the appropriate ASCII or curly quote, depending on the user's
> > configuration.  So a doc string might contain this:

> >      \`foo-bar\'

> I considered doing that, but there were problems.  First, it would make doc 
> strings harder to read.  For example, this:

> "Setting this attribute will also set the \`:family\',
> \`:foundry\', \`:width\', \`:height\', \`:weight\', and
> \`:slant\' attributes."

> is harder to read than this:

> "Setting this attribute will also set the ‘:family’, ‘:foundry’,
> ‘:width’, ‘:height’, ‘:weight’, and ‘:slant’ attributes."

Only marginally harder.  We routinely cope with \" and \n and so on
inside strings without problems.  \' and \` are no harder.  And the
number of strings with lots of single quoted symbols on a line is going
to be quite small.

> Second, the new escapes would cause mental overload with similar 
> already-existing uses (e.g., ?\`, "\\`").

We cope fine with ?\" in code and \" in strings.  The mental overload
for the corresponding ` and ' cases will be no higher.  And, most
importantly, it will be confined to the source code.  When reading the
doc strings with C-h f/v, the backslashes wouldn't be there.

> Third, and most serious, is that the new escapes would mean that string
> literals are not constants but are instead expressions whose values
> depend on runtime context, and this would affect everything: how the
> byte-compiler works, for example.

No, not at all.  My proposition is that string literals remain constants
just as they are now.  The decision would be made at configuration time,
and a trivial #ifdef in the reader would decide at build time how to
expand the escaped quotes.  The necessary change took me less than 20
minutes, having started with no familiarity of the reader:

--- lread.c	2015-06-08 12:54:35.000000000 +0000
+++ lread.c.acm	2015-06-10 17:58:01.000000000 +0000
@@ -2350,6 +2350,13 @@
 	return i;
       }
 
+#ifdef WITH_CURLY_QUOTES
+    case '\'':
+      return '?';
+    case '`':
+      return '?';
+#endif
+
     default:
       return c;
     }

.  As always, forgive me not having the requisite keys to type the actual
curly quote characters in the above.

> To avoid the most serious problem, I considered a simpler idea: have the Lisp 
> reader treat \` and \' as curved single quotes in strings.  However, this still 
> has the basic problem of being hard to read.  It is needless work to add a 
> hard-to-read and nearly-ubiquitous feature merely to cater to obsolete 
> platforms.  It's simpler to use quote characters to represent themselves.

By "obsolete platforms" you just mean ones you yourself don't like, I
think.  I believe it's a tradition that when retiring obsolete OS support
from Emacs, a single dissenting voice is sufficient to "rescue" an OS
from being dropped.  The same should apply here.

Emacs on the Linux console is used.  Gratuitously damaging functionality
on supported platforms is not something to be done lightly, particularly
when there's an easy, if tedious, way to carry on supporting them
properly.  The whole ethos of Emacs is about being able to set it up to
suit personal preferences.  I'm anxious that this continue.

As noted before you are proposing a massive philosophical change from
pure ASCII (modulo a few "display characters") source to (presumably
unrestricted) Unicode.  The number of unicode characters you want to
insert is in the tens of thousands.

> > Again, I think the only justification for the change you've given is that
> > you personally don't like the look

> It's not just me personally.  The rest of the world has moved on.

Much of the world might well have moved, but that's not grounds for
allowing ourselves to be dragged along with it.  If we allowed popularity
to be the deciding criterion for making our decisions, we'd all be using
MS-Windows.

> At this point when outsiders look at Emacs they see mysterious and
> inappropriate and off-putting quoting.  And this sort of thing has been
> happening for a while.  See, for example:

> http://www.trilithium.com/johan/2005/07/quotation-marks/

One person doesn't like 0x60 and 0x27 as quote marks.  So?  Follow my
suggestion above, and he can configure his Emacs with --with-curly-quotes
(or, more likely, just allow the default to take its course).  And if he
neither uses Emacs nor intends to, of what value are his opinions in this
thread?

-- 
Alan Mackenzie (Nuremberg, Germany).