From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#22983: syntax-ppss returns wrong result. Date: Fri, 11 Mar 2016 21:24:10 +0000 Message-ID: <20160311212410.GG2888@acm.fritz.box> References: <20160311151512.GD2888@acm.fritz.box> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1457731341 28329 80.91.229.3 (11 Mar 2016 21:22:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 11 Mar 2016 21:22:21 +0000 (UTC) Cc: 22983@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Mar 11 22:22:12 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aeUVe-00049K-69 for geb-bug-gnu-emacs@m.gmane.org; Fri, 11 Mar 2016 22:22:10 +0100 Original-Received: from localhost ([::1]:57724 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeUVd-0006Xw-Eq for geb-bug-gnu-emacs@m.gmane.org; Fri, 11 Mar 2016 16:22:09 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35936) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeUVZ-0006Xf-5l for bug-gnu-emacs@gnu.org; Fri, 11 Mar 2016 16:22:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aeUVV-0003mf-TY for bug-gnu-emacs@gnu.org; Fri, 11 Mar 2016 16:22:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:48394) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeUVV-0003mb-QD for bug-gnu-emacs@gnu.org; Fri, 11 Mar 2016 16:22:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aeUVV-00080Z-MG for bug-gnu-emacs@gnu.org; Fri, 11 Mar 2016 16:22:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 11 Mar 2016 21:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 22983-submit@debbugs.gnu.org id=B22983.145773129430750 (code B ref 22983); Fri, 11 Mar 2016 21:22:01 +0000 Original-Received: (at 22983) by debbugs.gnu.org; 11 Mar 2016 21:21:34 +0000 Original-Received: from localhost ([127.0.0.1]:45521 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aeUV4-0007zu-Bm for submit@debbugs.gnu.org; Fri, 11 Mar 2016 16:21:34 -0500 Original-Received: from mail.muc.de ([193.149.48.3]:57800) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aeUV2-0007zl-ID for 22983@debbugs.gnu.org; Fri, 11 Mar 2016 16:21:33 -0500 Original-Received: (qmail 3781 invoked by uid 3782); 11 Mar 2016 21:21:31 -0000 Original-Received: from acm.muc.de (p579E8E6B.dip0.t-ipconnect.de [87.158.142.107]) by colin.muc.de (tmda-ofmipd) with ESMTP; Fri, 11 Mar 2016 22:21:30 +0100 Original-Received: (qmail 6723 invoked by uid 1000); 11 Mar 2016 21:24:10 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:114791 Archived-At: Hello, Dmitry. On Fri, Mar 11, 2016 at 10:31:50PM +0200, Dmitry Gutov wrote: > On 03/11/2016 05:15 PM, Alan Mackenzie wrote: > > At this point, `ppss-1' and `parse' should match (apart from elements 2 > > and 6). What we actually have is: > > ppss-1: (2 39992 nil nil nil nil 2 nil nil (39975 39992)) > > parse: (0 nil 15674 34 nil nil 0 nil 15675 nil) > I think you mean that ppss-0 and ppss-1 must match independent of > narrowing, and also match (parse-partial-sexp 1 40000). Er no, I meant what I wrote: the result of (syntax-ppss pos) must match that of (parse-partial-sexp (point-min) pos). I think ppss-0 and ppss-1 did actually match (but I can't quite remember). > Considering narrowing can change point-min arbitrarily, specifying > (syntax-ppss pos) as (parse-partial-sexp (point-min) pos) is a losing > proposition if you want consistency. Indeed. But that is how syntax-ppss is specified, and (partially) how it is implemented. > Alas, we have some code out there that implements multiple-major-mode > functionality using narrowing and some hacking of syntax-ppss-last > syntax-ppss-cache values. > Changing syntax-ppss to be independent of narrowing will break it, and > we'll need to provide some alternative first. syntax-ppss is broken, and can't be fixed. The only sensible fix would be to specify that (syntax-ppss pos) is the same as (parse-partial-sexp 1 pos). But that is then a totally different function, and there are around 200 uses in the Emacs sources to check and fix, to say nothing of external code. > We could introduce a syntax-ppss-dont-widen variable, though. Similar to > font-lock-dont-widen. I'm trying to figure that out. Wouldn't that still leave you with problems when point-min is inside a string? -- Alan Mackenzie (Nuremberg, Germany).