emacs-devel
[Top][All Lists]

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

 From: Tassilo Horn Subject: Re: port x-symbol to GNU emacs 24. Date: Wed, 19 Aug 2015 21:05:44 +0200 User-agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.0.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>>> 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.

It doesn't compose \alpha2 so that's already handled correctly, no?  But
at the same time, it also doesn't compose .\alpha where . could be any
character with punctuation syntax.  And at least that's not right for
tex.

> 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).

Yes, that sounds like a good solution for making \alpha work when a
punctuation character preceedes it.

Bye,
Tassilo