[Top][All Lists]

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

Re: [Emacs-diffs] master c4151eb: Improve the optional translation of qu

From: Dmitry Gutov
Subject: Re: [Emacs-diffs] master c4151eb: Improve the optional translation of quotes
Date: Thu, 25 Jun 2015 17:56:03 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0

On 06/25/2015 05:05 PM, Paul Eggert wrote:

I didn't see any patch in that email, unfortunately -- perhaps you
forgot to include it?

Sorry, it's attached now.

True.  But it's still a temptation we should strive to avoid.

Depends on what we call complicated. Like Richard mentioned, at least we can try to leave unpaired quotes alone. Or not, I don't really care that much personally.

- Like you said: "describe-variable should curve the quotes in the doc
but not in the contents of the variable". The code that prints the
value will
need to add some text property to it ("verbatim"?
"font-lock-ignore"?), and the
font-lock rule can look it up and skip those regions. Nothing too hard.

As you'll recall, I don't understand font-lock.

There's no requirement for you to implement all of it yourself. You can take my patch, look for problems, and ask for them to be fixed.

You'll have to do the substitute-command-keys part, though.

That being said, I
worry that all this stuff would be complicated and would involve using
undocumented or poorly-documented features (see Bug#20613).

I've enumerated practical considerations of having it implemented *not* in font-lock. If some font-lock features lack documentation, demand it to be added, then.

Also, it's not clear how the overall approach would work on limited
displays that don't have alternate fonts and/or colors.  Suppose, for
example, that the user is running 'emacs --color=never' on a character

diff --git a/lisp/help-mode.el b/lisp/help-mode.el
index f99e916..6256513 100644
--- a/lisp/help-mode.el
+++ b/lisp/help-mode.el
@@ -287,6 +287,13 @@ Commands:
   (set (make-local-variable 'revert-buffer-function)
+  (setq font-lock-defaults '(nil t))
+  (font-lock-add-keywords
+   nil '(("`\\([^[:space:]'`‘’][^'`‘’]*\\)?'"
+         . (0 (progn (compose-region (match-beginning 0)
+                                     (1+ (match-beginning 0)) ?‘)
+                     (compose-region (1- (match-end 0)) (match-end 0) ?’)
+                     nil)))))
   (set (make-local-variable 'bookmark-make-record-function)

reply via email to

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