unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: 20707@debbugs.gnu.org
Subject: bug#20707: [PROPOSED PATCH] Use curved quoting in C-generated errors
Date: Sat, 6 Jun 2015 15:54:45 +0000	[thread overview]
Message-ID: <20150606155445.GE3418@acm.fritz.box> (raw)
In-Reply-To: <55707236.6060605@cs.ucla.edu>

Hello, Paul.

On Thu, Jun 04, 2015 at 08:43:50AM -0700, Paul Eggert wrote:
> Alan Mackenzie wrote:
> > a typical use of Q would look like this:

> >      error ("Buffer name " Q(%s) " is in use", SDATA (name));

> I'm afraid that's not sufficient, as sometimes we have code like this:

[ .... ]

> though this is starting to get ugly.

> The more serious problem, though is that neither approach will work well in the 
> Elisp code, which is where the vast majority of these quotes live.

[ .... ]

> I considered changing 'format' so that it automatically curves quotes in the 
> format string.  But that would mishandle common cases like this:

>       (format "\\`%s" path-separator)

> where 'format' is being used to compose a regular expression containing '\`'.

> More reasonable would be to add a new function, 'format-message', that behaves 
> like 'format' except it also curves quotes, and to change functions like 
> 'message' and 'error' to use 'format-message' instead of plain 'format'.  But 
> even here we have lots of examples like this:

>       (y-or-n-p (format "File `%s' exists; overwrite? " filename))

> where we'd have to change 'format' to 'format-message'.

> We could go the GCC route and add a new format flag 'q', so that the above 
> examples could be written like this:

>      (format "Parsing %qs: expected %s %qs, got %qs." a b c d)
>      (y-or-n-p (format "File %qs exists; overwrite? " filename))

, or even "Parsing `%qs': expected %s `%qs', got `%qs'.", where the q
means "make the surrounding quote marks display marks".

> This approach would make sense if 8-bit environments were still common, as they 
> were when GCC added the 'q' flag to its message formatter.  However, nowadays 
> 8-bit environments are obsolescent (sorry) and so this approach seems like 
> overkill now.

8-bit environments may not be all that common any more, at least on a
desktop machine, but what about over comms links?  Linux consoles are not
rare: anybody on a G/L machine without X (e.g. a server) will be using
one, as well as those, such as I, who prefer the directness and lack of
distraction the console provides.

On the Linux console, there are a maximum of 256 glyphs which can be
displayed (or 512 if you're prepared to do without half of the colours),
each of which can be assigned to an arbitrary set of unicode characters.
This limit is a hangover from video hardware made ~30 years ago, and it
is a shame that it still persists, even on modern software generated
video.

> If we are bothering to go through code to fix quotes, it's better 
> to change the above examples to:

>      (format "Parsing ‘%s’: expected %s ‘%s’, got ‘%s’." a b c d)
>      (y-or-n-p (format "File ‘%s’ exists; overwrite? " filename))

I assume that the single quotes in there are the curly ones.  I literally
cannot see the difference, since the two varieties of quotes are mapped
to the same glyphs in my consolefont.  (The curly double quotes are not
mapped at all, hence display as inverse question mark.).

I think it is this lack of WYSIWYH ("what you see is what you have") that
makes me most unhappy about this proposed change to curly quotes.

> for two reasons.  First, unlike %qs the resulting code will work on older Emacs 
> implementations and thus will make the code more backward-compatible.

But it will not work well on a console, even with the most recent Emacs.

> Second, it's easier to read and maintain quote marks that you can see.

See the `%qs' idea above.

-- 
Alan Mackenzie (Nuremberg, Germany).





  reply	other threads:[~2015-06-06 15:54 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-01  7:39 bug#20707: [PROPOSED PATCH] Use curved quoting in C-generated errors Paul Eggert
     [not found] ` <mailman.4052.1433144480.904.bug-gnu-emacs@gnu.org>
2015-06-01 10:49   ` Alan Mackenzie
2015-06-01 16:01     ` Paul Eggert
2015-06-01 17:17       ` Alan Mackenzie
2015-06-01 18:50         ` Paul Eggert
2015-06-02 11:56           ` Alan Mackenzie
2015-06-02 13:25             ` Drew Adams
2015-06-02 15:39             ` Paul Eggert
2015-06-02 15:51               ` Dmitry Gutov
2015-06-02 20:05                 ` Paul Eggert
2015-06-02 17:07               ` Alan Mackenzie
2015-06-02 20:44                 ` Alan Mackenzie
2015-06-04 15:43                   ` Paul Eggert
2015-06-06 15:54                     ` Alan Mackenzie [this message]
2015-06-06 18:11                       ` Paul Eggert
2015-06-06 20:50                         ` Alan Mackenzie
2015-06-07  0:09                           ` Paul Eggert
2015-06-08 17:18                             ` Alan Mackenzie
2015-06-09  6:53                               ` Paul Eggert
2015-06-09 13:34                                 ` Alan Mackenzie
2015-06-09 20:49                                   ` Paul Eggert
2015-06-09 22:46                                     ` Alan Mackenzie
2015-06-09 23:42                                       ` Paul Eggert
2015-06-10 13:39                                         ` Alan Mackenzie
2015-06-10 16:20                                           ` Paul Eggert
2015-06-10 17:39                                             ` Dmitry Gutov
2015-06-10 19:42                                               ` Paul Eggert
2015-06-10 19:17                                             ` Alan Mackenzie
2015-06-10 19:44                                               ` Paul Eggert
2015-06-11 19:06                                                 ` Alan Mackenzie
2015-06-12  2:41                                                   ` Paul Eggert
2015-06-12 11:25                                                     ` Alan Mackenzie
2015-06-12 23:46                                                       ` Paul Eggert
2015-06-13 11:54                                                         ` Alan Mackenzie
2015-06-13 17:54                                                           ` Paul Eggert
2015-06-07 13:17                       ` Wolfgang Jenkner
2015-06-09 16:58                         ` Alan Mackenzie
2015-06-02 23:26                 ` Paul Eggert
2015-06-01 14:34 ` Eli Zaretskii
2015-06-01 16:48   ` Glenn Morris
2015-06-01 17:55   ` Paul Eggert
2015-06-01 18:29     ` Eli Zaretskii
2015-06-01 21:13     ` Stefan Monnier
2015-06-09 19:44 ` Wolfgang Jenkner
2015-06-11 13:06 ` bug#20707: " Andy Moreton
2020-08-12 13:02 ` bug#20707: [PROPOSED PATCH] " Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150606155445.GE3418@acm.fritz.box \
    --to=acm@muc.de \
    --cc=20707@debbugs.gnu.org \
    --cc=eggert@cs.ucla.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).