Subject: Re: bug#20385: [PATCH] Support curved quotes in doc strings

From: Dmitry Gutov <[email-masked]>
Date: Wed, 20 May 2015 05:22:00 +0300

On 05/20/2015 02:27 AM, Paul Eggert wrote:
> OK, I tried that, but it didn't work for me.  The attached patch works
> much of the time, but it causes annoying glitches on the screen (for an
> example see attached, created by "emacs -Q" and 'C-h b'; note the red
> color glitch after the double-quote).

That's how a string is highlighted. :) You can press C-u C-x = to see 
which face is used there.

So apparently, font-lock-add-keywords turns on font-lock-mode, and since 
it's never set up in help-mode otherwise, syntactic fontification is 
used (and " is a string delimiter in the standard syntax table). Adding 
this (t is the key) before the call resolves that:

   (setq font-lock-defaults '(nil t))

But in a major mode, I think you're expected to apply all font-lock 
settings via setting font-lock-defaults, not by using 
font-lock-add-keywords (the format of keywords is the same).

> Even if I ignore the glitches, I found it disconcerting that the "wrong"
> characters were used to display text characters (or, from another point
> of view, that the buffer's contents were "wrong" compared to what was on
> the screen).

That shouldn't matter much in a read-only buffer...

> So I'm inclined to do something less tricky, e.g., simply
> replace characters in the *Help* buffer before displaying the buffer.  I
> plan to look into that next.

...but indeed, this approach could be the simpler one.