From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stephen Gildea Newsgroups: gmane.emacs.devel Subject: a property "definition-type" would help find macro-defined tests Date: Sat, 21 Dec 2024 08:53:47 -0800 Message-ID: <353457.1734800027@pental.sg.gildea.net> 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="30734"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Dec 21 17:54:58 2024 Return-path: Envelope-to: ged-emacs-devel@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 1tP2kg-0007kk-AS for ged-emacs-devel@m.gmane-mx.org; Sat, 21 Dec 2024 17:54:57 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tP2jo-0007Uh-IJ; Sat, 21 Dec 2024 11:54:00 -0500 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 1tP2jn-0007UF-6i for emacs-devel@gnu.org; Sat, 21 Dec 2024 11:53:59 -0500 Original-Received: from tigger.sg.gildea.net ([99.65.78.170] helo=tigger3.gildea.net) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tP2jl-0008Qb-6O for emacs-devel@gnu.org; Sat, 21 Dec 2024 11:53:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gildea.com; i=@gildea.com; q=dns/txt; s=2023b; t=1734800027; h=from : to : subject : mime-version : content-type : content-id : date : message-id : from; bh=LiTh37iT6udLzhxaZYAqZfpA999W1EBeaDHVMd6b8fE=; b=tRT6ruTwOJvaBUM/f7awZwh+26WYDs9MU6ySKnzyDTyeZ7vrx4zFZBEuKmn8DXPGtxYOS uc4bfjj7XRIySXI29xXkC7AutNWfKUXrHQzYD7MNJXzHkMJd6Qes4msYvCEubicV6P/Ww+l h++uSGWXMXT6J73VlxSln9N9ItG7BMtWffyl0ZanpuPqMs564uc971lp02OS4PA0dmoXjhU etdD8KSenGKNM11AwFTeiD23hEvjBSk3Sw1DpAuUH+AxCq1rGMlUl6dvP5/IkwxUFQAZqBy pYJMBNZjGrdugbAHGZRT2RceQUt5JcQj0+XXqTLZFnISpiUFmLXh0g2c2qfg== Original-Received: from pental.sg.gildea.net (pental.wg.gildea.net [192.168.113.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "pental-mail", Issuer "gildea.net Mail Root CA" (verified OK)) by tigger3.gildea.net (Postfix) with ESMTPS id 729B63E165D for ; Sat, 21 Dec 2024 08:53:47 -0800 (PST) Original-Received: from pental.sg.gildea.net (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by pental.sg.gildea.net (Postfix) with ESMTPS id 55CF82B4B7F for ; Sat, 21 Dec 2024 08:53:47 -0800 (PST) X-Mailer: MH-E 8.6+git; nmh 1.8+dev; Emacs 31.0.50 Content-ID: <353455.1734800027.1@pental.sg.gildea.net> Received-SPF: pass client-ip=99.65.78.170; envelope-from=stepheng+emacs@gildea.com; helo=tigger3.gildea.net 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, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:326822 Archived-At: The find-function feature of Emacs cannot find "ert-deftest" forms generated by a macro. (The find-func library does look through macro expansions in its search, but the search is too specific to find "ert-deftest" forms.) Function "find-function-search-for-symbol" is passed a "type" for the thing to look for, but that type is based on the caller's idea of what the thing is. We need a way to say what the definer thinks the definition looks like. The existing property "definition-name" isn't helpful here because often the call to a test-defining macro contains test data only. I propose a new property, "definition-type", that a macro could put on a symbol. If present, "find-function-search-for-symbol" would use that type instead of the passed-in type. With this enhancement, any subsystem that uses a macro to define objects could - have the macro set property "definition-type" on the symbols it defines, and - add an entry to "find-function-regexp-alist" saying how to find the new type. Concretely, here's the code change I'm proposing: diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index f3ddf9f81c9..df1eb8deae0 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el @@ -409,6 +409,8 @@ find-function-search-for-symbol ;; Some functions are defined as part of the construct ;; that defines something else. (while (and (symbolp symbol) (get symbol 'definition-name)) (setq symbol (get symbol 'definition-name))) + (setq type (or (get symbol 'definition-type) + type)) (if (string-match "\\`src/\\(.*\\.\\(c\\|m\\)\\)\\'" library) (find-function-C-source symbol (match-string 1 library) type) Does this seem like a generally useful addition? < Stephen