From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: forward-comment and syntax-ppss Date: Thu, 08 Dec 2016 16:47:51 -0500 Message-ID: References: <20161206195507.GA2996@acm.fritz.box> <83fd1db0-7362-6117-c5cd-715398c0dea4@gmail.com> <20161207220447.GA4503@acm.fritz.box> <20161208201517.GB3120@acm.fritz.box> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1481233701 20103 195.159.176.226 (8 Dec 2016 21:48:21 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 8 Dec 2016 21:48:21 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 08 22:48:14 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cF6Y0-0003Kh-2u for ged-emacs-devel@m.gmane.org; Thu, 08 Dec 2016 22:48:12 +0100 Original-Received: from localhost ([::1]:49206 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cF6Y2-0004s8-EC for ged-emacs-devel@m.gmane.org; Thu, 08 Dec 2016 16:48:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46866) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cF6Xv-0004r8-Bx for emacs-devel@gnu.org; Thu, 08 Dec 2016 16:48:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cF6Xs-0006gL-9U for emacs-devel@gnu.org; Thu, 08 Dec 2016 16:48:07 -0500 Original-Received: from [195.159.176.226] (port=55353 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cF6Xs-0006fA-1s for emacs-devel@gnu.org; Thu, 08 Dec 2016 16:48:04 -0500 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1cF6Xi-0001Q6-Or for emacs-devel@gnu.org; Thu, 08 Dec 2016 22:47:54 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 18 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:FWptUurqfq583p1V1me8ykMDN5c= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:210162 Archived-At: > 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. Stefan