|
From: | Dmitry Gutov |
Subject: | Re: /srv/bzr/emacs/trunk r101338: * lisp/emacs-lisp/syntax.el (syntax-ppss): More sanity check to catch |
Date: | Tue, 11 Feb 2014 01:36:36 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 |
On 10.02.2014 18:18, Stefan Monnier wrote:
IIRC the reason was so that (syntax-ppss) called from a place like a "column-0 just before an open paren" can correctly indicate if this open paren is within a string/comment while at the same time parsing the subsequent text assuming that this open paren was outside of any string/comment.
Why? That sounds confusing.
In mmm-mode, we call the default font-lock-fontify-region function with bounds of each subregion as arguments, and we also try to limit `syntax-ppss' to these regions, so the `syntax-begin-function' brings point to the beginning of the current subregion.But there's no guarantee syntax-begin-function will be used at all, so I'm not sure how important changing this test is. Is it really sufficient to make syntax-ppss understand mmm's sub-modes?
Not exactly. But if it worked the way I expected, it would've been easier for me to fix fontification in subregions when it's affected by a character in the primary region above it when it's "string opener/closer" in the submode's syntax table, but punctuation in the primary mode syntax: https://github.com/purcell/mmm-mode/issues/37
I would've bound `syntax-ppss-last` and `syntax-ppss-cache` to nil around the region and let it be forced to call the syntax-begin-function.
Since that didn't work, I now seem to be successfully fooling syntax-ppss by let-binding `syntax-ppss-last' to (beg-of-subregion . nil), and fontification is as expected. Maybe that'll even work for indentation, too.
But it seems like `mmm-beginning-of-syntax' is entirely useless now (since its result is discarded most of the time, and when not, it could only bring inconsistency). Because it dates back from 2000, about 10 years prior to the aforementioned revision, maybe it should take priority. Or not, since nobody complained in the 3.5 years since.
[Prev in Thread] | Current Thread | [Next in Thread] |