From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Thuna Newsgroups: gmane.emacs.bugs Subject: bug#62959: [PATCH] Recognize defstruct slot names in various eieio functions Date: Thu, 20 Apr 2023 00:15:50 +0200 Message-ID: <87o7njv7qh.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5236"; mail-complaints-to="usenet@ciao.gmane.io" To: 62959@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Apr 20 00:17:20 2023 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 1ppG75-00016y-Ci for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 20 Apr 2023 00:17:19 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppG6r-0002Ko-F7; Wed, 19 Apr 2023 18:17:06 -0400 Original-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 1ppG6p-0002Kb-Gq for bug-gnu-emacs@gnu.org; Wed, 19 Apr 2023 18:17:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ppG6o-0006DZ-T5 for bug-gnu-emacs@gnu.org; Wed, 19 Apr 2023 18:17:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ppG6o-0007Qr-9L for bug-gnu-emacs@gnu.org; Wed, 19 Apr 2023 18:17:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Thuna Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 19 Apr 2023 22:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 62959 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.168194258528518 (code B ref -1); Wed, 19 Apr 2023 22:17:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 19 Apr 2023 22:16:25 +0000 Original-Received: from localhost ([127.0.0.1]:36051 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ppG5y-0007Pb-Gi for submit@debbugs.gnu.org; Wed, 19 Apr 2023 18:16:25 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:36780) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ppG5r-0007PO-E5 for submit@debbugs.gnu.org; Wed, 19 Apr 2023 18:16:07 -0400 Original-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 1ppG5r-0002Eg-02 for bug-gnu-emacs@gnu.org; Wed, 19 Apr 2023 18:16:03 -0400 Original-Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ppG5p-00067c-6B for bug-gnu-emacs@gnu.org; Wed, 19 Apr 2023 18:16:02 -0400 Original-Received: by mail-ej1-x635.google.com with SMTP id a5so1955270ejb.6 for ; Wed, 19 Apr 2023 15:16:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681942559; x=1684534559; h=mime-version:message-id:date:subject:to:from:from:to:cc:subject :date:message-id:reply-to; bh=ljvDATw9R2xJH0n6mVlpx+PLgeHqOdC2RAIVyqI6y0g=; b=N+U9D4WW5Aa87pp1Hwfmp2QonauwKyq/XP4aVcro44OYOUIz8RGaXSg9fseOxk3hlg qK0NAICwZSJ2AIMk3dcdThgBbbOQtA/k/2V8T4ZKnWxdcMkyrradHDMrZn7mOk89VyV9 S844ZlxqtkneA8Gg48FJbM+WnirqVvrkzTumsoJhRJEFGaD8kmnfrlyVinJAESKTANm7 8rTWKYUcTIkvqec2E4WN8mMeHSEE1c1oUjB1ex3pjqCNAk5w/kwhXCn0MFvxlspMBjHv ZYyQ1335H+uxLAslneZvY4LFE3J/DP/4dH3gvOUXJsHuyx/fKjdbMEj0xrwBnTplLHlG /38A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681942559; x=1684534559; h=mime-version:message-id:date:subject:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=ljvDATw9R2xJH0n6mVlpx+PLgeHqOdC2RAIVyqI6y0g=; b=GQtgsiU+WpoBDcZrnkAbIbB2FVyk45r+z6yKbnkKfnmUJi52jqMk+6C6FL5e11bBa5 cKKDkZcB8S5jg2kTnVSWlVUdqTvqAEiOZNcRFlQKiT1kRyhFPNRwW6vPJEqG+mXmqAk6 +rqo+bNGCB5/C8kCYQmtqpiOoonlS981W0UNdjNwDXQB5qnxqGruLgOLLnb/Y/TWOgqm DOQ6vrSOVCs73KHCYYfxy2Fb6+D/LVYRK6ztjbnmeIFg6skXQFQGNjHgUYH5fHotkPGF aKx/mUDu09iQsR51RXoG8kZQAvIYrDbC0UH6MFrCha6gcsQ+j7KGbSbi9OgEDuNocTh9 Z/vQ== X-Gm-Message-State: AAQBX9f3yg/G2LWGHvvwvYgyBaubsom57GxwYGzKN69bE93uDQmpl6vQ 17feKNFsmhtdqYjEkzL/YXuIJvsAStg= X-Google-Smtp-Source: AKy350YY4AWwdf875DxolGfSppF7+hTgZFspahhF4TRdR+kF68KxQaXh69WjvnCyFhVPlvz+cQYu/A== X-Received: by 2002:a17:906:4e0b:b0:94e:bd38:49bb with SMTP id z11-20020a1709064e0b00b0094ebd3849bbmr18416938eju.23.1681942558774; Wed, 19 Apr 2023 15:15:58 -0700 (PDT) Original-Received: from thuna ([78.177.102.2]) by smtp.gmail.com with ESMTPSA id z4-20020a170906434400b0094f2dca017fsm6097ejm.50.2023.04.19.15.15.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Apr 2023 15:15:58 -0700 (PDT) Received-SPF: pass client-ip=2a00:1450:4864:20::635; envelope-from=thuna.cing@gmail.com; helo=mail-ej1-x635.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:260297 Archived-At: --=-=-= Content-Type: text/plain The function `eieio--known-slot-name-p' is used by some eieio functions (specifically eieio-oref, eieio-oref-default, and eieio-oset-default) to check whether a slot name is known or not, and if not signals an "Unknown slot" warning. Structs do not make their slots known to `eieio--known-slot-name-p', so the warning is signaled even for valid slot names. Since eieio aims for compatibility with defstruct, this should probably be considered a bug. The function `eieio--known-slot-name-p' checks the variable `eieio--known-slot-names' but also has a fallback for the name's `slot-name' property. In the patch I opted to use the latter. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Recognize-defstruct-slot-names-in-various-eieio-func.patch Content-Description: The patch >From 86ed1ed7d024a0d40286d5fe4697258dc98a1b9e Mon Sep 17 00:00:00 2001 From: Thuna Date: Wed, 19 Apr 2023 23:43:22 +0200 Subject: [PATCH] Recognize defstruct slot names in various eieio functions * lisp/emacs-lisp/cl-preloaded.el (cl-struct-define): Set each slot's name's `slot-name' property so that `eieio--known-slot-name-p' can recognize them. --- lisp/emacs-lisp/cl-preloaded.el | 1 + 1 file changed, 1 insertion(+) diff --git a/lisp/emacs-lisp/cl-preloaded.el b/lisp/emacs-lisp/cl-preloaded.el index 9445093f143..5235be52996 100644 --- a/lisp/emacs-lisp/cl-preloaded.el +++ b/lisp/emacs-lisp/cl-preloaded.el @@ -176,6 +176,7 @@ cl-struct-define (i 0) (offset (if type 0 1))) (dolist (slot slots) + (put (car slot) 'slot-name t) (let* ((props (cl--plist-to-alist (cddr slot))) (typep (assq :type props)) (type (if (null typep) t -- 2.39.2 --=-=-=--