From unknown Sat Aug 09 13:26:48 2025 X-Loop: help-debbugs@gnu.org Subject: bug#78884: 30.1; peg-parse does not treat its arguments as sequence Resent-From: Tim Landscheidt Original-Sender: "Debbugs-submit" Resent-CC: monnier@iro.umontreal.ca, bug-gnu-emacs@gnu.org Resent-Date: Tue, 24 Jun 2025 00:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 78884 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 78884@debbugs.gnu.org Cc: Stefan Monnier X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: Stefan Monnier Received: via spool by submit@debbugs.gnu.org id=B.17507239485493 (code B ref -1); Tue, 24 Jun 2025 00:13:02 +0000 Received: (at submit) by debbugs.gnu.org; 24 Jun 2025 00:12:28 +0000 Received: from localhost ([127.0.0.1]:33619 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uTrH1-0001QR-Ga for submit@debbugs.gnu.org; Mon, 23 Jun 2025 20:12:27 -0400 Received: from lists.gnu.org ([2001:470:142::17]:34276) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uTrGz-0001Pi-1G for submit@debbugs.gnu.org; Mon, 23 Jun 2025 20:12:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uTrGs-0000rA-TK for bug-gnu-emacs@gnu.org; Mon, 23 Jun 2025 20:12:18 -0400 Received: from gavdos.tim-landscheidt.de ([2a01:4f8:1c0c:4bd6::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uTrGr-0006b2-Bk for bug-gnu-emacs@gnu.org; Mon, 23 Jun 2025 20:12:18 -0400 Received: from port-62-145-29-194.static.as20676.net ([62.145.29.194]:58688 helo=vagabond) by gavdos.tim-landscheidt.de with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uTrGj-000Ut1-3B for bug-gnu-emacs@gnu.org; Tue, 24 Jun 2025 00:12:13 +0000 From: Tim Landscheidt Organization: https://www.tim-landscheidt.de/ Date: Tue, 24 Jun 2025 00:12:11 +0000 Message-ID: <875xgmdmlg.fsf@vagabond.tim-landscheidt.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a01:4f8:1c0c:4bd6::1; envelope-from=tim@tim-landscheidt.de; helo=gavdos.tim-landscheidt.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) The docstring for Emacs 30.1's peg-parse reads: | (peg-parse &rest PEXS) | Match PEXS at point. | PEXS is a sequence of PEG expressions, implicitly combined with =E2=80=98= and=E2=80=99. | Returns STACK if the match succeed and signals an error on failure, | moving point along the way. However, it will fail with (for example) "Wrong type argument: listp" when called as such: | ELISP> (with-temp-buffer | (insert "ABCDEF") | (goto-char (point-min)) | (peg-parse | (bob) | "ABC")) | *** Eval error *** Wrong type argument: listp, "ABC" | ELISP> An explicit sequence with "and" works: | ELISP> (with-temp-buffer | (insert "ABCDEF") | (goto-char (point-min)) | (peg-parse | (and | (bob) | "ABC"))) | t | ELISP> From unknown Sat Aug 09 13:26:48 2025 X-Loop: help-debbugs@gnu.org Subject: bug#78884: 30.1; peg-parse does not treat its arguments as sequence Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 24 Jun 2025 18:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 78884 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Tim Landscheidt Cc: 78884@debbugs.gnu.org Received: via spool by 78884-submit@debbugs.gnu.org id=B78884.175078876824689 (code B ref 78884); Tue, 24 Jun 2025 18:13:02 +0000 Received: (at 78884) by debbugs.gnu.org; 24 Jun 2025 18:12:48 +0000 Received: from localhost ([127.0.0.1]:48084 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uU88W-0006Q8-G4 for submit@debbugs.gnu.org; Tue, 24 Jun 2025 14:12:48 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:45585) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uU88T-0006P9-Le for 78884@debbugs.gnu.org; Tue, 24 Jun 2025 14:12:46 -0400 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id E59DF1000BC; Tue, 24 Jun 2025 14:12:38 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1750788757; bh=UcEdMqP7jgJIWc+7H1FHiJvR0MF3crYm6cOMM2F5h5Y=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=CetKpssK3BKE4EIvKTkGDwr5luptmwsLgl2KhxAWNh/7mlmfs1xH0oMv5tCaotd9b 9ejzCHoaVb//fTFUrwRW8PdOA6/nI1/cN7VcAWyP3v2W8FxJCtTbx298/H4OnYDWWP HHDRoco4anyHL7Zgqu5sM2Fnua/T7D+GnRlcMGGqzah1UaSjAYhqzYE0cN7Z/+i0AO fGviNu0r95JVD1aV+nvgLuHD02mFF7rjdnxg+q9HoWqxy2+s2l5NpTUknhTL5+EwtD h137Jo/KEmH19K7hPhFSZhHNEGSl7bgyiYX4OQaO2Va9/pwoJJr76wAooC9csH8UV9 khFbVVhBB5zLA== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id E3841100029; Tue, 24 Jun 2025 14:12:37 -0400 (EDT) Received: from pastel (unknown [104.247.225.139]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id BD820120682; Tue, 24 Jun 2025 14:12:37 -0400 (EDT) From: Stefan Monnier In-Reply-To: <875xgmdmlg.fsf@vagabond.tim-landscheidt.de> Message-ID: References: <875xgmdmlg.fsf@vagabond.tim-landscheidt.de> Date: Tue, 24 Jun 2025 14:12:36 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.318 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Tim Landscheidt [2025-06-24 00:12:11] wrote: > The docstring for Emacs 30.1's peg-parse reads: > > | (peg-parse &rest PEXS) > > | Match PEXS at point. > | PEXS is a sequence of PEG expressions, implicitly combined with =E2=80= =98and=E2=80=99. > | Returns STACK if the match succeed and signals an error on failure, > | moving point along the way. > > However, it will fail with (for example) "Wrong type > argument: listp" when called as such: > > | ELISP> (with-temp-buffer > | (insert "ABCDEF") > | (goto-char (point-min)) > | (peg-parse > | (bob) > | "ABC")) > | *** Eval error *** Wrong type argument: listp, "ABC" > | ELISP> > > An explicit sequence with "and" works: > > | ELISP> (with-temp-buffer > | (insert "ABCDEF") > | (goto-char (point-min)) > | (peg-parse > | (and > | (bob) > | "ABC"))) > | t > > | ELISP> Can you check that the quick-fix below fixes things on your side (and not just for your example)? Stefan diff --git a/lisp/progmodes/peg.el b/lisp/progmodes/peg.el index 7827990af35..b5ffff31362 100644 --- a/lisp/progmodes/peg.el +++ b/lisp/progmodes/peg.el @@ -320,8 +320,9 @@ peg-parse moving point along the way." (if (and (consp (car pexs)) (symbolp (caar pexs)) - (not (ignore-errors - (not (eq 'call (car (peg-normalize (car pexs)))))))) + (not (or (get (peg--rule-id (caar pexs)) 'peg--rule-definition) + (ignore-errors + (not (eq 'call (car (peg-normalize (car pexs))))))))) ;; The first of `pexs' has not been defined as a rule, so assume ;; that none of them have been and they should be fed to ;; `with-peg-rules' From unknown Sat Aug 09 13:26:48 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Tim Landscheidt Subject: bug#78884: closed (Re: bug#78884: 30.1; peg-parse does not treat its arguments as sequence) Message-ID: References: <875xgmdmlg.fsf@vagabond.tim-landscheidt.de> X-Gnu-PR-Message: they-closed 78884 X-Gnu-PR-Package: emacs Reply-To: 78884@debbugs.gnu.org Date: Sat, 28 Jun 2025 03:16:05 +0000 Content-Type: multipart/mixed; boundary="----------=_1751080565-12735-1" This is a multi-part message in MIME format... ------------=_1751080565-12735-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #78884: 30.1; peg-parse does not treat its arguments as sequence which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 78884@debbugs.gnu.org. --=20 78884: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D78884 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1751080565-12735-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 78884-done) by debbugs.gnu.org; 28 Jun 2025 03:15:59 +0000 Received: from localhost ([127.0.0.1]:45393 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uVM2o-0003Ib-IK for submit@debbugs.gnu.org; Fri, 27 Jun 2025 23:15:58 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:57326) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uVM2m-0003Hk-QR for 78884-done@debbugs.gnu.org; Fri, 27 Jun 2025 23:15:57 -0400 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 5C00D4409C3; Fri, 27 Jun 2025 23:15:51 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1751080550; bh=qbRI97rmKu8TtAi0m51QIAJwF8n9cRWIXK6ddXOLlFs=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=fibsgTaDiycrxQCzmb0g8kIMDhPiwohlklQYf4c7D/nFSCcJHeko5J55DOjp/6JRv 4cFzCKxK+1PbxQ4AHVQ+yTfS7VaFU3sKFL1OjmQXoINj75Uq2ACmUpcXjMUCwUTs2L dbbdGY7G0ZrtqHEX14oY4keyihBqDgv1jpbnV9QQtsVA013OupDxgDoOLNh3JEeXum yCvkEJS9bjKZfpFVBYLYYfhrzmzQDvs7y1pIR+RVnnlm/1PvSn1UV4DEQTpDR66ZSn CixRL9/LS56RnFbDOhFOSJQTa5ZTNKgvM35RZbAMMUIgNSC57diS3+K2VG2M2hQvcW JbC/xMsXCUu7w== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 11ADC4409B4; Fri, 27 Jun 2025 23:15:50 -0400 (EDT) Received: from pastel (unknown [104.247.225.139]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id E38D012062E; Fri, 27 Jun 2025 23:15:49 -0400 (EDT) From: Stefan Monnier To: Tim Landscheidt Subject: Re: bug#78884: 30.1; peg-parse does not treat its arguments as sequence In-Reply-To: Message-ID: References: <875xgmdmlg.fsf@vagabond.tim-landscheidt.de> Date: Fri, 27 Jun 2025 23:15:48 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.296 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 78884-done Cc: 78884-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Can you check that the quick-fix below fixes things on your side (and > not just for your example)? Well, I pushed it to `master`, and I'm closing the bug. In case it's not fully fixed, feel free to reopen, of course. Stefan ------------=_1751080565-12735-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 24 Jun 2025 00:12:28 +0000 Received: from localhost ([127.0.0.1]:33619 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uTrH1-0001QR-Ga for submit@debbugs.gnu.org; Mon, 23 Jun 2025 20:12:27 -0400 Received: from lists.gnu.org ([2001:470:142::17]:34276) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uTrGz-0001Pi-1G for submit@debbugs.gnu.org; Mon, 23 Jun 2025 20:12:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uTrGs-0000rA-TK for bug-gnu-emacs@gnu.org; Mon, 23 Jun 2025 20:12:18 -0400 Received: from gavdos.tim-landscheidt.de ([2a01:4f8:1c0c:4bd6::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uTrGr-0006b2-Bk for bug-gnu-emacs@gnu.org; Mon, 23 Jun 2025 20:12:18 -0400 Received: from port-62-145-29-194.static.as20676.net ([62.145.29.194]:58688 helo=vagabond) by gavdos.tim-landscheidt.de with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uTrGj-000Ut1-3B for bug-gnu-emacs@gnu.org; Tue, 24 Jun 2025 00:12:13 +0000 From: Tim Landscheidt To: bug-gnu-emacs@gnu.org Subject: 30.1; peg-parse does not treat its arguments as sequence Organization: https://www.tim-landscheidt.de/ X-Debbugs-Cc: Stefan Monnier Date: Tue, 24 Jun 2025 00:12:11 +0000 Message-ID: <875xgmdmlg.fsf@vagabond.tim-landscheidt.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a01:4f8:1c0c:4bd6::1; envelope-from=tim@tim-landscheidt.de; helo=gavdos.tim-landscheidt.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) The docstring for Emacs 30.1's peg-parse reads: | (peg-parse &rest PEXS) | Match PEXS at point. | PEXS is a sequence of PEG expressions, implicitly combined with =E2=80=98= and=E2=80=99. | Returns STACK if the match succeed and signals an error on failure, | moving point along the way. However, it will fail with (for example) "Wrong type argument: listp" when called as such: | ELISP> (with-temp-buffer | (insert "ABCDEF") | (goto-char (point-min)) | (peg-parse | (bob) | "ABC")) | *** Eval error *** Wrong type argument: listp, "ABC" | ELISP> An explicit sequence with "and" works: | ELISP> (with-temp-buffer | (insert "ABCDEF") | (goto-char (point-min)) | (peg-parse | (and | (bob) | "ABC"))) | t | ELISP> ------------=_1751080565-12735-1--