|
From: | Lennart Borgman (gmail) |
Subject: | Re: Problems with syntax-ppss |
Date: | Mon, 07 Apr 2008 17:14:08 +0200 |
User-agent: | Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666 |
Stefan Monnier wrote:
Would it not be a good idea to (i) redefine syntax-ppss as calculating the syntax from BOB (as opposed to (point-min));That's already what it does, when it can. Maybe it could be improved as follows: signal an error if it needs to recompute from (point-min) and (point-min) is not the beginning of the buffer, unless the caller sets a `syntax-ppss-narrowed-is-ok' variable (for use in modes like Info and Rmail). Maybe that variable should be shared with font-lock-dont-widen.
Until I had to start reading the code I thought that font-lock-dont-widen already took care of this. I think there have to be a way to tell syntax-ppss not to widen otherwise I can't see what purpose font-lock-dont-widen could have (but I guess I am missing something there?).
Adding a new variable syntax-ppss-narrowed-is-ok might be good, but should not font-lock-dont-widen be honored regardless of this? Or should perhaps font-lock set the new variable as needed?
(ii) have several caches, each associated with a particular syntax table (how many modes are going to use more than 2 or, perhaps, 3?);This may incur a significant cost. I much prefer to let the caller decide when a change of syntax-table requires flushing the cache.
Looks better to me since flushing is done based on the position in the buffer.
Another approach might be to introduce a `syntax-ppss-syntax-table'.
[Prev in Thread] | Current Thread | [Next in Thread] |