help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: [prettify-symbols-mode] Two consecutive matches don't work?


From: Tassilo Horn
Subject: Re: [prettify-symbols-mode] Two consecutive matches don't work?
Date: Wed, 18 May 2022 12:54:41 +0200
User-agent: mu4e 1.7.21; emacs 29.0.50

Robert Pluim <rpluim@gmail.com> writes:

>     Joost> I'm dealing with some `.xml` files that contain data which uses the
>     Joost> sequence `<<!` as some sort of operator. Because it's XML, the
>     Joost> LESS-THAN sign needs to be encoded as `&lt;`, yielding `&lt;&lt;!`.
>
>     Joost> So I thought this would be the ideal use case for
>     Joost> `prettify-symbols-mode`. I added `("&lt;" . ?<)` to
>     Joost> `prettify-symbols-alist` and activated the mode.
>
>     Joost> Unfortunately, only the first `&lt;` in each sequence is
>     Joost> prettified. This seems to be due to the fact that the second 
> `&lt;` is
>     Joost> followed by the exclamation mark: if I insert a space in between,
>     Joost> prettification works.
>
>     Joost> Is there any way to remedy this?
>
> Looks like a bug to me. I tried "&lt;&lt;", but exhibits the same
> behaviour.

The problem is that in <a>&lt;&lt;</a> (symbol-at-point) on the first
&lt says "<a>&lt" and on the second "&lt".  I think there might be even
two bugs:

  1. nxml-mode: It feels wrong that <a>&lt is considered a symbol.  And
     that the closing ; isn't part of the symbol &lt; seems also not
     correct.  And why do < and > have symbol syntax.  Wouldn't
     open/close paren be more appropriate?

  2. prettify-symbols: It seems wrong that the second &lt; is prettified
     because its not a single symbol but a symbol &lt plus the character
     ; which as punctuation syntax.

Bye,
Tassilo



reply via email to

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