emacs-devel
[Top][All Lists]

## Re: port x-symbol to GNU emacs 24.

 From: Stefan Monnier Subject: Re: port x-symbol to GNU emacs 24. Date: Wed, 19 Aug 2015 13:29:46 -0400 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

>> prettify-symbols-alist does currently handle non-symbol chars.
>> Whether it handles this specific case, I'm not completely sure (tho
>> I'm pretty sure it'll mishandle "\alpha2", in any case).  But we
>> should make prettify-symbols-alist handle the needs of TeX, so feel
>> free to suggest extensions to prettify-symbols-alist if that's needed.
> Well, it's actually not as simple as I've thought before.  It does in
> fact handle some non-symbol things but it depends on the syntax before
> and after the matched thing.

Indeed.  And if we want to handle \alpha2 correctly, I think we'll need
to extend prettify-symbols-mode somehow to let latex-mode teach
prettify-symbols-mode how to properly recognize whether a given \alpha
should be composed or not.

In some earlier prettify-symbols code (the one used in haskell-mode),
I extended the alist so that each element can have a predicate checking
whether this occurrence should be composed (this is used in Haskell for
the "." which can either be the function-composition infix operator, or
the usual separator used within identifiers as in List.map).

We should probably extend prettify-symbols-alist similarly,
but in the case of TeX, I think setting a predicate for every entry is
inconvenient, and we should instead set a "global" predicate which is
applied to every entry (and is used instead of the default code which
checks the syntax-class of surrounding characters).

Stefan