GNU bug report logs - #39390
28.0.50; prettify-symbols-mode confuses display when start/end faces are different

Previous Next

Package: emacs;

Reported by: Raphael 'kena' Poss <knz <at> thaumogen.net>

Date: Sun, 2 Feb 2020 15:44:01 UTC

Severity: normal

Found in version 28.0.50

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Raphael 'kena' Poss <knz <at> thaumogen.net>
Cc: 39390 <at> debbugs.gnu.org
Subject: bug#39390: 28.0.50; prettify-symbols-mode confuses display when start/end faces are different
Date: Sun, 02 Feb 2020 19:18:52 +0200
> From: Raphael 'kena' Poss <knz <at> thaumogen.net>
> Date: Sun, 2 Feb 2020 15:45:46 +0100
> 
> (add-hook 'go-mode-hook
>  (lambda ()
>    (push '("error" . ?⊙) prettify-symbols-alist)
>    ;; (push '("err != nil" . "⊙?") prettify-symbols-alist)
>  ))
> 
> However if I then uncomment the second substitution for "err != nil":
> all hell breaks loose: moving the cursor up and down around a source
> line containing this text will mess up the display of the lines that
> follow in a way that is sometimes irrecoverable.
> 
> The display bug is exacerbated (and thus easier to recognize/reproduce)
> when global-hl-line-mode is set.
> 
> I have traced this down to substitutions where the font-lock face at the
> beginning and the end of the symbol composition is different:
> 
> - replacing "String" is OK, replacing ".String()" is not
> - replacing "func" is OK, replacing "func(" is not
> - replacing "Fatal" is OK, replacing "t.Fatal" is not
> 
> This probably needs to be fixed somehow, either by preventing the
> problem or by documenting the pitfall.
> 
> I would like to know if a workaround is available?

You've bumped into a fundamental limitation of the feature, called
"character composition", that prettify-symbols-mode piggy-backs to do
its thing: Emacs can only compose characters that all have the same
face.  This restriction is imposed on a very low level of the display
code.

So I don't think there can be a workaround, except by "fixing" the
font-lock faces to use the same face on all the characters you want to
substitute.




This bug report was last modified 5 years and 124 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.