emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Emacs-diffs] master 9ce1d38: Use curved quotes in core elisp diagno


From: Paul Eggert
Subject: Re: [Emacs-diffs] master 9ce1d38: Use curved quotes in core elisp diagnostics
Date: Tue, 18 Aug 2015 23:28:32 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0

Dmitry Gutov wrote:
> So yes, I think it's valuable.

OK, thanks for reviewing; I installed the %q patch, and followed up with simplifications that it allows at the C level, mostly by using %qs in formats instead of uLSQM and uRSQM. This makes the C code easier to read and so is a clear win. Doing something similar in Elisp code makes the code harder to read, though, so I held off on that.

two format sequences, one for opening quote, and one for closing. That
would be more cumbersome, though.

Yes, it would be more cumbersome.  Instead of the current:

  (message "Press ‘?’ or ‘h’ for help, ‘q’ to quit")

we would have something like:

  (message "Press %<?%> or %<h%> for help, %<q%> to quit")

which is harder to read and is more error-prone. This less-readable approach is used in GCC's source code, which must port to old-fashioned C++ compilers that lack support for multibyte characters in strings. It is not needed for Emacs Lisp, and we shouldn't insist on it there.

Also, it wouldn't suffice for code like this:
 >
     (insert (symbol-name type)
             (format " is a type (of kind ‘"))
     (help-insert-xref-button (symbol-name metatype)
                              'cl-help-type metatype)
     (insert (format "’)"))

But this is not about diagnostic messages anymore, right? At the moment, IIRC,
these situations are handled by substitute-command-keys (and there's no need to
have curly quotes in the strings here).

At the moment these situations are handled by ‘format’. Simply changing the code to use ‘substitute-command-keys’ and ASCII characters would not work in cases like the above, because (insert (substitute-command-keys "')")) would insert an apostrophe regardless of user text-quoting preference. Of course there are workarounds but the workarounds are clumsy. (Also, the ASCII-only-source approach would typically be a tad slower, which is annoying. :-)

text -> (substitute-command-keys) -> text with "escaped" text prop
      -> (translate-quotes) -> text with non-escaped straight quotes replaces

As mentioned above it's not obvious how to get that to work; even if we did so it'd be more complicated and error-prone, and a bit slower. Hardly seems worth it.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]