[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [AUCTeX-devel] more symbols in pretty
From: |
Uwe Brauer |
Subject: |
Re: [AUCTeX-devel] more symbols in pretty |
Date: |
Thu, 22 Oct 2015 12:24:34 +0300 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:36.0) Gecko/20100101 Firefox/36.0 SeaMonkey/2.33.1 |
On 10/22/2015 12:05 PM, Tassilo Horn wrote:
> Uwe Brauer <address@hidden> writes:
>
>>> To decide if something is to be prettified, there's
>>> `prettify-symbols-compose-predicate' which is
>>> `TeX--prettify-symbols-compose-p' in AUCTeX. Basically, that looks
>>> at the char after the found symbol to decide if it is to be
>>> prettified.
>>
>>> Examples:
>>
>>> \alpha ;; prettified
>>> \alphafoo ;; not prettified cause foo is still part of the symbol
>>> \alpha2 ;; prettified because a number is not part of a macro
>>> \|U ;; not prettified because the U could be part of the macro
>>
>> I see. I find the idea that
>>
>>> \|U ;; not prettified because the U could be part of the macro
>>
>> Could be a macro a bit odd, I would expect
>>
>> \|#1
>> to be a macro, but I will not argue about it.
>
> Well, it's all just heuristics. Basically, AUCTeX
> `TeX--prettify-symbols-compose-p' just asserts that
> `tex--prettify-symbols-compose-p' returns non-nil and we're not in a
> verbatim block. But it's all just heuristics which generally assumes
> that the prettified symbols have the form "\\\\[[:word:]]+".
>
> You could try this definition:
>
> --8<---------------cut here---------------start------------->8---
> (defun tex--prettify-symbols-compose-p (_start end _match)
> (or (not (eq ?w (char-syntax (char-before end))))
> (let* ((after-char (char-after end))
> (after-syntax (char-syntax after-char)))
> (not (or
> ;; Don't compose address@hidden
> (eq after-char ?@)
> ;; The \alpha in \alpha2 or \alpha-\beta may be composed but
> ;; of course \alphax may not.
> (and (eq after-syntax ?w)
> (not (memq after-char
> '(?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9 ?+ ?- ?' ?\"))))
> ;; Don't compose inside verbatim blocks.
> (eq 2 (nth 7 (syntax-ppss))))))))
> --8<---------------cut here---------------end--------------->8---
>
> But I'm not sure if that has wicked side-effects.
>
> Bye,
> Tassilo
>
thanks I will try out and report back.
smime.p7s
Description: S/MIME Cryptographic Signature