[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: forward-comment and syntax-ppss

From: Stefan Monnier
Subject: Re: forward-comment and syntax-ppss
Date: Thu, 08 Dec 2016 16:47:51 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

> Can parse-partial-sexp parse backwards?

No.  Two reasons: one is that we don't have code that (attempts to)
do(es) that, the other is that it's fundamentally difficult/impossible
to do it reliably.

More specifically, the patch "forward-comment and syntax-ppss" is
specifically handling a case where we really don't know how to parse
backward: when moving backward, forward-comment generally tries to find
the beginning of a comment by "parsing backward", but in some cases it
really can't figure it out and (currently) resorts to calling
(parse-partial-sexp (point-min) POS).  Since it may potentially do that
for every "comment-end" marker it finds (e.g. every \n in most major
modes), there are pathological cases where the performance in large
buffers can become really poor, hence the need for a cache.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]