[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Giving "text quotes" syntax in font-lock-syntax-table only
From: |
Stefan Monnier |
Subject: |
Re: Giving "text quotes" syntax in font-lock-syntax-table only |
Date: |
Tue, 02 Jun 2020 14:46:33 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Sorry for not getting back to you sooner.
I see you (plural) decided to switch to highlighting math elements using
regexps rather than the syntax-table. That sounds like a wise choice.
> This resembles the method to modify the major mode's syntax table
> (without setting `syntax-ppss-table'). It does eliminate the wrong
> fontification, but brings another problem in actual use cases of AUCTeX.
> When `syntax-ppss-table' is non-nil, all functions using `syntax-ppss'
> obey that syntax table, so they regard math expression $...$ as string
> constant. This can be problematic for cases like this:
Indeed. What you could do if you still want to use syntax-tables rather
than regexp, is to add an entry to the beginning of `font-lock-keywords`
which does the equivalent of `font-lock-fontify-syntactically-region`
but without using `syntax-ppss` and using its own syntax-table.
Maybe this actually argues that `font-lock-fontify-syntactically-region`
should use `font-lock-syntax-table` rather than `syntax-ppss-table` and
should refrain from using `syntax-ppss` when that syntax-table is
different from that of syntax-ppss.
Stefan
- Re: Giving "text quotes" syntax in font-lock-syntax-table only,
Stefan Monnier <=