On 10/22/2015 12:05 PM, Tassilo Horn wrote: > Uwe Brauer <[email protected]> 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 \alpha@foo. > (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
_______________________________________________ auctex-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/auctex-devel
