[Top][All Lists]

[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: Dmitry Gutov
Subject: Re: [Emacs-diffs] master 9ce1d38: Use curved quotes in core elisp diagnostics
Date: Tue, 18 Aug 2015 14:31:53 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:40.0) Gecko/20100101 Thunderbird/40.0

On 08/18/2015 02:55 AM, Paul Eggert wrote:

Do you mean replacing this sort of thing:

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

with this?

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


If so, this doesn't sound like a good idea, as it would make the code
harder to read.

It looks okay to me, but if you don't like it, the first option is available as well: two format sequences, one for opening quote, and one for closing. That would be more cumbersome, though.

I've taken the idea for %qs from GCC. Do you know if they handle the above kind of situation somehow specially?

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).

which formats the matching quotes separately.  Of course in general one
could rewrite even the latter example to use %qs (if only to grab the
quote characters out of the result string and reuse them individually!)
but the rewritten version would be significantly harder to read and

I'm definitely not suggesting that.

As we need to support formatting individual curved quotes anyway, there
is an argument for keeping it simple and omitting the attached patch for
paired quotes.  With all this in mind, do you still think the complexity
of the attached draft patch is a good idea?

This patch solves the problem of "curved quotes in core elisp diagnostics", which you've felt neccessary to resolve with 9ce1d38890a77e93af0d20f51c53419c097200d3, kicking off this discussion.

So yes, I think it's valuable.

And if your point is that by having this logic in `format', we won't need it in `substitute-command-keys', then I stand by the assertion that a separate, different, function should translate the quotes.

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

`format' can't serve as `translate-quotes', because, like you said, "\\`%s\\'" is a relatively common format string.

reply via email to

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