[Top][All Lists]

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

Escaping quotes in docstrings, Was: A simple solution to "Upcoming loss

From: Dmitry Gutov
Subject: Escaping quotes in docstrings, Was: A simple solution to "Upcoming loss of usability ..."
Date: Sun, 28 Jun 2015 23:27:25 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0

On 06/28/2015 06:20 PM, Paul Eggert wrote:

That rule is too complicated.  Please let's keep it simple.  It's
simpler to explain if the escape sequence always works.  It should be
rare to need these escapes, so it's OK if they are multicharacter.

Well, if you think so.

about your other suggestion of using backslash-tilde?  This would be \\~
in the source-file string.  This is unlikely to occur in docstrings;
there are no occurrences in the current Emacs sources.

I remember Stefan disliking \\=. But okay, let's try this one.

+   nil '(("\\(?:\\=\\|[^\\]\\)\\(\\\\*\\)[`']"

First, this translates all apostrophes to quotes.  It should translate
only the apostrophes that are used as quotes (i.e., those that match
grave accents). That's what the current master does, and what your
earlier prototype did.  We shouldn't try to second-guess unmatched
apostrophe, any more than we should try to second-guess double-quote.

You expressed dislike for "action at a distance" and wanted a simple translation, so there it was. Ok, let's try matching.

Second, the last bracketed RE should be [`'‘’] if we are to mimic the
current-master behavior.  (However, please see the next comment.)

There's no technical difficulty there, but I don't want to see curly quotes used as markup.

And if we also want to translate them to help with terminals that can't display curlies, the translation should affect all curlies, not just the markup ones (so we can't limit it to paired quotes, or unescaped ones).

As I understand it, the need for help-quote-translation has gone away,
since the primary impetus for it was that one couldn't easily search for
quotes, and that problem has been fixed in the meantime by Artur's
commits.  So this part can be simplified and the code can always assume
that the above expression evaluates to t.  (This is also true of the
current master of course.)

IIUC, there was also a problem with some terminals that can't display them, and also users that would prefer not to see them in Help. Maybe we can disregard the latter, at least for now.

I meant an example of a Help buffer where we must not translate quotes
in the value.

Ah, OK, try loading the attached file.  The file name contains accent
grave and apostrophe, which should not be translated when one types ‘C-h
v foo’.

Thanks. The last patch seems to successfully deal with it already.

PS.  Can you please attach patches instead of pasting them bodily into
your email?  I could not apply the patch in your email automatically, as
some characters were munged somewhere in the process.

Ok. But I'd rather push to the scratch/quote-escaping branch, if you don't mind.

reply via email to

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