From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#22983: syntax-ppss returns wrong result. Date: Fri, 11 Mar 2016 23:35:08 +0200 Message-ID: <73903215-f94b-e194-7bfe-0d6350c95769@yandex.ru> References: <20160311151512.GD2888@acm.fritz.box> <20160311212410.GG2888@acm.fritz.box> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1457732186 13420 80.91.229.3 (11 Mar 2016 21:36:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 11 Mar 2016 21:36:26 +0000 (UTC) Cc: 22983@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Mar 11 22:36:15 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 1aeUjG-0002Yy-UK for geb-bug-gnu-emacs@m.gmane.org; Fri, 11 Mar 2016 22:36:15 +0100 Original-Received: from localhost ([::1]:57773 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeUjD-0002i5-2V for geb-bug-gnu-emacs@m.gmane.org; Fri, 11 Mar 2016 16:36:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39689) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeUj9-0002hR-CE for bug-gnu-emacs@gnu.org; Fri, 11 Mar 2016 16:36:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aeUj4-0007rz-90 for bug-gnu-emacs@gnu.org; Fri, 11 Mar 2016 16:36:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:48402) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeUj4-0007ru-61 for bug-gnu-emacs@gnu.org; Fri, 11 Mar 2016 16:36:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aeUj3-0008Kf-V3 for bug-gnu-emacs@gnu.org; Fri, 11 Mar 2016 16:36:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 11 Mar 2016 21:36: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.145773211831978 (code B ref 22983); Fri, 11 Mar 2016 21:36:01 +0000 Original-Received: (at 22983) by debbugs.gnu.org; 11 Mar 2016 21:35:18 +0000 Original-Received: from localhost ([127.0.0.1]:45529 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aeUiL-0008Ji-TX for submit@debbugs.gnu.org; Fri, 11 Mar 2016 16:35:18 -0500 Original-Received: from mail-wm0-f41.google.com ([74.125.82.41]:34109) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aeUiK-0008JV-RE for 22983@debbugs.gnu.org; Fri, 11 Mar 2016 16:35:17 -0500 Original-Received: by mail-wm0-f41.google.com with SMTP id p65so33715393wmp.1 for <22983@debbugs.gnu.org>; Fri, 11 Mar 2016 13:35:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=aIoibPXfW/WZ6cPlrBuy+f++GBE0LQLbPtRxHQR8PjU=; b=ibk7dPwL3eREHjvRP+HucMp/Gn7A1m2SeYH1BeVFmgPuzwVxSXY50/8YwTa6GoRprQ cGYnWIofvxcB1eN6EshJ9Vj61dHZq/XrzConwt9CYbP8YjBlWwYi8+/pc30YQJEbwluB 8zVO+azh/bdG5WVYbFIdScVkr/UbkiUB5Pa12kF9klSHFIRpBjo9izWZjfY6wZJX2hqU mgbawp4iBHhEe2xVarKn51jGw/QJzxpoQGS5244PxrlbHTofRtzOSB2riuikUO9iBWdx 2PqvbcTxARdFy8wWnToL3H4O5MMVnEJtzm+84dMvRcnIp2XDX29YDd3qgrnmc3Eda0pw L5pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:cc:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=aIoibPXfW/WZ6cPlrBuy+f++GBE0LQLbPtRxHQR8PjU=; b=ARruz85E6gQ6EqLLk19qKsN4F+wWjkkwGYK23NzWk5nb6k0EVjq5qboo7up6IiNq1Q OR9BWdpVGboNgANTUmZznEvvGrU0iF65LLD1KDlK1eSsv3vkw/A5GpB4CQk6WCacYdbT gFhl1ZbivlNlF3R9IQjJnfN6s/Mo0Lo4olqo3p0latFEOzdKzUSgQeEP6JWEMdDCBsGl AufYrc6izqLNGn8unWsuXWVPA+1vP80TJ1VFLwsJji4DlUmMQal96jHxsPfvgNT5luvU V2gCEDpUS9jOE4r2pxriS36M5ZOaugjlQT/RkgJ9yUe64RF0i7AeLNlnY65Glvz1V+ev UtTw== X-Gm-Message-State: AD7BkJIec9thOPh7mOk6hpsjoY6uzlhs6qBvhbjlvzkYMYv+Rq8kyAB06MZbyC85xSpnMg== X-Received: by 10.28.184.148 with SMTP id i142mr5229306wmf.22.1457732111036; Fri, 11 Mar 2016 13:35:11 -0800 (PST) Original-Received: from [192.168.1.2] ([185.105.175.24]) by smtp.googlemail.com with ESMTPSA id up6sm10251376wjc.6.2016.03.11.13.35.09 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 11 Mar 2016 13:35:10 -0800 (PST) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0 In-Reply-To: <20160311212410.GG2888@acm.fritz.box> 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:114793 Archived-At: On 03/11/2016 11:24 PM, Alan Mackenzie wrote: >> 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). I imagine they didn't. I got the same value in all three cases, though, so your scenario could use some revising. >> 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. That part of specification can be rephrased. >> 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. It's used ubiquitously, so it must be working. > 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. Not entirely different, no. AFAIK, these are the semantics the vast majority of its usages expect. Except the multiple-major-mode case, which we'd ideally try to accommodate, too. >> 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? syntax-ppss-dont-widen would be nil by default, it would be an escape hatch toward the current semantics, for when the caller knows how to manage narrowings, etc.