From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#58531: 29.0.50; Wrong predicate used by map-elt gv getter Date: Sat, 15 Oct 2022 11:52:27 -0400 Message-ID: References: <87r0zaxeox.fsf@tcd.ie> <874jw6xe9h.fsf@tcd.ie> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39972"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 58531@debbugs.gnu.org To: "Basil L. Contovounesios" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Oct 15 17:53:17 2022 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 1ojjTR-000AAq-KW for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 15 Oct 2022 17:53:17 +0200 Original-Received: from localhost ([::1]:50660 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ojjTP-0001sF-6l for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 15 Oct 2022 11:53:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42108) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ojjTB-0001rF-U9 for bug-gnu-emacs@gnu.org; Sat, 15 Oct 2022 11:53:01 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43474) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ojjTB-0000SA-MD for bug-gnu-emacs@gnu.org; Sat, 15 Oct 2022 11:53:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ojjTB-0002uy-Hh for bug-gnu-emacs@gnu.org; Sat, 15 Oct 2022 11:53:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 15 Oct 2022 15:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58531 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 58531-submit@debbugs.gnu.org id=B58531.166584916511187 (code B ref 58531); Sat, 15 Oct 2022 15:53:01 +0000 Original-Received: (at 58531) by debbugs.gnu.org; 15 Oct 2022 15:52:45 +0000 Original-Received: from localhost ([127.0.0.1]:42552 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ojjSv-0002uN-2s for submit@debbugs.gnu.org; Sat, 15 Oct 2022 11:52:45 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:61033) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ojjSm-0002u0-MX for 58531@debbugs.gnu.org; Sat, 15 Oct 2022 11:52:43 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id EF8F54408AC; Sat, 15 Oct 2022 11:52:29 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 6C9E44407D7; Sat, 15 Oct 2022 11:52:28 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1665849148; bh=t5ENjMfjets5+3DTTbWXxENpahUXMu8RG1GBiUktdQ0=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=pi1wA2VoqQvDoNt1I6bkDPsCZMK3vsxrh4mjlQSXafSFojZh/bxZ1+rNmMFuEYh4U LapkbqxjWVAOS1rKulQW2wuX3zaYiBpaiOFfc+xz0X4JeDiHJneX0rkwb1cFPRDPc9 ZKmA+UexRVLyAI3Bv/qh27W850dkzRlipJWLxzgvWxG4P97/IGdv0/2jxbqR5XZ+fR QdQVetpn1OrDpDWB8+ctqE0OT5mox+QZXvVfECrNJCNwbK0tBY20HgVj0QKPzwGhfY rFXI07BxL/jNfeI27tMYL0+Pr//o7qEqg7I0B95QBVr4eBEpX9o4fOYMw4tS/BqTF+ MWcgymlIAqH9w== Original-Received: from pastel (65-110-220-202.cpe.pppoe.ca [65.110.220.202]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 2EA72120E9E; Sat, 15 Oct 2022 11:52:28 -0400 (EDT) In-Reply-To: <874jw6xe9h.fsf@tcd.ie> (Basil L. Contovounesios's message of "Sat, 15 Oct 2022 00:54:18 +0300") 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:245573 Archived-At: > (defun map--plist-delete (map key) > (let ((tail map) last) > @@ -346,7 +399,7 @@ map-contains-key > If MAP is an alist, TESTFN defaults to `equal'. > If MAP is a plist, `plist-member' is used instead." > (if (map--plist-p map) > - (plist-member map key) > + (map--plist-member map key testfn) > (let ((v '(nil))) > (not (eq v (alist-get key map v nil (or testfn #'equal))))))) Hmmm looks like we forgot to mark the `testfn` arg obsolete here with `advertised-calling-convention` like we did for `map-elt`. Could you fix that oversight in your patch while you're at it? > -(defun eudc-plist-member (plist prop) > - "Return t if PROP has a value specified in PLIST." > - (if (not (= 0 (% (length plist) 2))) > +(defun eudc--plist-member (plist prop &optional predicate) > + "Like `plist-member', but signal on invalid PLIST." > + ;; Could also use `plistp', but that would change the error. > + (or (zerop (% (length plist) 2)) > (error "Malformed plist")) > - (catch 'found > - (while plist > - (if (eq prop (car plist)) > - (throw 'found t)) > - (setq plist (cdr (cdr plist)))) > - nil)) > + (plist-member plist prop predicate)) The current error is poor (it doesn't include the offending plist, for example), so I think changing it (e.g. using the usual `wrong-type-argument` error) would be for the better. I do wonder whether it's worth the trouble keeping the error here, tho, instead of just using `plist-member` directly. Stefan