emacs-devel
[Top][All Lists]
Advanced

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

Re: forward-comment and syntax-ppss


From: Andreas Röhler
Subject: Re: forward-comment and syntax-ppss
Date: Fri, 9 Dec 2016 08:39:21 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:45.0) Gecko/20100101 Icedove/45.4.0



On 08.12.2016 22:47, Stefan Monnier wrote:
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).

Another argument why syntax-ppss shouldn' t be used at all, thanks.


   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.



Performance of parse-partial-sexp was very fast in its original design. May our masters of circular dependencies have managed to slow it down? At any case: the question is, if you need the info from point-min. If yes, there is not other way than calling it from there. If not, don't ask for it, give a nearer boundary.



reply via email to

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