bug#81611: 31.0.90; show-paren-mode reports false mismatch

Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <[email protected]>
Newsgroups gmane.emacs.bugs
Message-ID <[email protected]>
>> > Suggested fix: Before narrowing, check syntax-ppss at the cutoff; if it
>> > is inside a string or comment, don't cut there -- but snap forward (or
>> > backward) to a position outside strings/comments.
>> 
>> +1
>> 
>> And I believe the "snap forward" can be done by `parse-partial-sexp` with
>> COMMENTSTOP arg of `syntax-table`.  The snap backward is simpler (just
>> jump to (nth 8 ppss)), but could jump very far back if the
>> string/comment is very long.
>
> Wouldn't syntax-ppss run the risk of going far back?

Of course, but if it does, it's presumably to the benefit of all other
users of `syntax-ppss`, such as the backward-sexp call we'll do to find
the opening paren.  Also, in practice, font-lock should have caused
`syntax-ppss` to be updated at least until point, so it should be
"cheap" to compute at (- (point) blink-matching-paren-distance).


=== Stefan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.