From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#49944: parse-partial-sexp fails to signal an error when (> START LIMIT). Date: Sun, 8 Aug 2021 18:51:27 +0000 Message-ID: References: <87r1f36by6.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17605"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 49944@debbugs.gnu.org, Stefan Monnier To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Aug 08 20:52:09 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mCnu5-0004OV-Ds for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 08 Aug 2021 20:52:09 +0200 Original-Received: from localhost ([::1]:45788 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mCnu4-0000HQ-2I for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 08 Aug 2021 14:52:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58390) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mCnty-0000HF-1i for bug-gnu-emacs@gnu.org; Sun, 08 Aug 2021 14:52:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43303) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mCntx-0002ji-RM for bug-gnu-emacs@gnu.org; Sun, 08 Aug 2021 14:52:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mCntx-0002ko-PU for bug-gnu-emacs@gnu.org; Sun, 08 Aug 2021 14:52:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 08 Aug 2021 18:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49944 X-GNU-PR-Package: emacs Original-Received: via spool by 49944-submit@debbugs.gnu.org id=B49944.162844869810558 (code B ref 49944); Sun, 08 Aug 2021 18:52:01 +0000 Original-Received: (at 49944) by debbugs.gnu.org; 8 Aug 2021 18:51:38 +0000 Original-Received: from localhost ([127.0.0.1]:54849 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mCnta-0002kE-Jc for submit@debbugs.gnu.org; Sun, 08 Aug 2021 14:51:38 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:25321 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1mCntX-0002jx-1Q for 49944@debbugs.gnu.org; Sun, 08 Aug 2021 14:51:37 -0400 Original-Received: (qmail 70228 invoked by uid 3782); 8 Aug 2021 18:51:28 -0000 Original-Received: from acm.muc.de (p2e5d50f8.dip0.t-ipconnect.de [46.93.80.248]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 08 Aug 2021 20:51:27 +0200 Original-Received: (qmail 7407 invoked by uid 1000); 8 Aug 2021 18:51:27 -0000 Content-Disposition: inline In-Reply-To: <87r1f36by6.fsf@gnus.org> X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:211410 Archived-At: Hello, Lars. On Sun, Aug 08, 2021 at 20:14:25 +0200, Lars Ingebrigtsen wrote: > Alan Mackenzie writes: > > On calling > > > > (parse-partial-sexp 19 18 nil nil s) > (What's `s' here?) Sorry, should have said. It was a syntax state at position 19, something like: (0 nil 8 34 nil nil 0 nil 13 nil nil) representing a "normal" string starting at position 13. > > Emacs surely ought to signal an error, since 18 < 19. > It's common for Emacs functions that take a region to not care about > whether to is larger than from or not. parse-partial-sexp doesn't work on a region. It works with a starting position and ending position, which are not interchangeable. For example, the status s (above) is the status at 19, not at 18. > The > validate_region (&from, &to); > function fixes it up. It doesn't fix it up, it messes it up. > > It doesn't, > > though. It leaves point at a random position and returns > > > > (0 nil nil nil nil nil 0 nil nil nil nil) > For me it leaves point at 19. I think it may have done that for me, too, though perhaps not every time. Getting back on topic, I think there are no legitimate uses for (> start limit), and every such call is a bug. It would seem such a call discards the input state argument, which would be a bug in itself if the whole thing weren't a bug. It's obvious to me that Emacs should throw an error in these circumstances. You seem to be disagreeing, or at least to be unsure. One data point is it took me over an hour's time to track it down, time that could have been better spent if Emacs had thrown an error. > -- > (domestic pets only, the antidote for overdose, milk.) > bloggy blog: http://lars.ingebrigtsen.no -- Alan Mackenzie (Nuremberg, Germany).