From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: forward-comment and syntax-ppss Date: Thu, 8 Dec 2016 20:15:17 +0000 Message-ID: <20161208201517.GB3120@acm.fritz.box> References: <20161206195507.GA2996@acm.fritz.box> <83fd1db0-7362-6117-c5cd-715398c0dea4@gmail.com> <20161207220447.GA4503@acm.fritz.box> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1481228154 7362 195.159.176.226 (8 Dec 2016 20:15:54 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 8 Dec 2016 20:15:54 +0000 (UTC) User-Agent: Mutt/1.5.24 (2015-08-30) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 08 21:15:47 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 1cF56X-0000Vl-DJ for ged-emacs-devel@m.gmane.org; Thu, 08 Dec 2016 21:15:45 +0100 Original-Received: from localhost ([::1]:48711 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cF56a-0005yx-UJ for ged-emacs-devel@m.gmane.org; Thu, 08 Dec 2016 15:15:48 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48093) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cF56V-0005sH-Ab for emacs-devel@gnu.org; Thu, 08 Dec 2016 15:15:44 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cF56S-0006MJ-35 for emacs-devel@gnu.org; Thu, 08 Dec 2016 15:15:43 -0500 Original-Received: from ocolin.muc.de ([193.149.48.4]:56176 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1cF56R-0006Lv-Ij for emacs-devel@gnu.org; Thu, 08 Dec 2016 15:15:39 -0500 Original-Received: (qmail 27715 invoked by uid 3782); 8 Dec 2016 20:15:37 -0000 Original-Received: from acm.muc.de (p548C7568.dip0.t-ipconnect.de [84.140.117.104]) by colin.muc.de (tmda-ofmipd) with ESMTP; Thu, 08 Dec 2016 21:15:36 +0100 Original-Received: (qmail 3406 invoked by uid 1000); 8 Dec 2016 20:15:17 -0000 Content-Disposition: inline In-Reply-To: X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 193.149.48.4 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:210152 Archived-At: Hello, Stefan. On Wed, Dec 07, 2016 at 09:32:50PM -0500, Stefan Monnier wrote: > > Read up on bug #22983. Basically, syntax-ppss is fundamentally broken. > > It won't work with narrowing of buffers, and delivers inconsistent > > results which aren't in accordance with what the function's doc says it > > does. This breakage isn't anything that can be fixed. > > The only way to deal with it seems to be to remove syntax-ppss and > > replace it with a new function. > And how would the new function not face the same breakage that can't be > fixed? It would have a sensible definition. "Returns the equivalent of (parse-partial-sexp (point-min) POS)" is a silly definition which cannot be coded up in any reasonable fashion. I think it should be replaced by "returns the equivalent of (parse-partial-sexp 1 POS)", which can be readily implemented. I propose, additionally, a new buffer local variable which, if non-nil, will contain a buffer position to use in place of the "1". > As you should know, your comment-cache code suffers from the exact same > problem. Rubbish. Modulo any remaining bugs, it does what it says it does. > It's a fundamental problem in caching parsing data in the face of > narrowing, given the fact that our narrowing primitive don't say what > is the intention behind it. Nor should it. Our primitives `car', `cdr', `list', etc. also don't say what the intention behind them is; they just work. Narrowing is what it is. Simple and austere. Complexifying narrowing by introducing a notion of "intention" would surely make it more difficult to use and possibly foul things up massively. > If you think your comment-cache works well (i.e. you consider its > failures .... What failures? If you've found any, please tell me specifically what, so that I can fix it/them. Please stop spreading FUD like this. > .... to be caused by inappropriate use of narrow-to-region), then it's > trivial to "fix" syntax-ppss in the same way: just put a `widen` in it > and voilą: "fundamentally broken" solved. Rubbish again. "Returns the equivalent of (parse-partial-sexp (point-min) POS)" cannot be implemented in any reasonable fashion, and just putting a `widen' into the current code won't change that one bit. As I said above, I think syntax-ppss should be retired and replaced by a function which does parse-partial-sexp starting at 1 rather than (point-min). > Stefan -- Alan Mackenzie (Nuremberg, Germany).