From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Musings: Supposed places of safety, guaranteed by parse-partial-sexp are not safe. Date: Sat, 03 Dec 2011 22:39:37 -0500 Message-ID: References: <20111203232301.GD4566@acm.acm> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1322969988 6396 80.91.229.12 (4 Dec 2011 03:39:48 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 4 Dec 2011 03:39:48 +0000 (UTC) Cc: emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Dec 04 04:39:44 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RX2vX-00033x-TD for ged-emacs-devel@m.gmane.org; Sun, 04 Dec 2011 04:39:44 +0100 Original-Received: from localhost ([::1]:37818 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RX2vX-0000np-7Z for ged-emacs-devel@m.gmane.org; Sat, 03 Dec 2011 22:39:43 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:46206) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RX2vU-0000nj-MB for emacs-devel@gnu.org; Sat, 03 Dec 2011 22:39:41 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RX2vT-0006Sw-Ok for emacs-devel@gnu.org; Sat, 03 Dec 2011 22:39:40 -0500 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:36916) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RX2vT-0006Sp-Lx for emacs-devel@gnu.org; Sat, 03 Dec 2011 22:39:39 -0500 Original-Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id pB43dbmg004261; Sat, 3 Dec 2011 22:39:37 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 2F39558CC3; Sat, 3 Dec 2011 22:39:37 -0500 (EST) In-Reply-To: <20111203232301.GD4566@acm.acm> (Alan Mackenzie's message of "Sat, 3 Dec 2011 23:23:01 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.91 (gnu/linux) X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4060=0 X-NAI-Spam-Version: 2.2.0.9286 : core <4060> : streams <707561> : uri <1021340> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.22 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:146474 Archived-At: > There's a problem with parse-partial-sexp. If one scans to the middle > of a comment opener /* > ^ > | > , parse-partial-sexp gives no indication that we might be half inside a [...] > No doubt there is some record of this state hidden away in (nth 9 state). IIRC you're just a bit too optimistic: parse-partial-sexp does not record this info anywhere. And yes, if my recollection is right, that means it's got a bug. The better way to fix it is probably to change the (nth 5 ppss) value so it holds something like "buffer position actually described by PPSS in case the requested buffer position is in the middle of a lexeme" and so it can be used for both backslashes and multi-char comment markers. Stefan