* a property "definition-type" would help find macro-defined tests
@ 2024-12-21 16:53 Stephen Gildea
0 siblings, 0 replies; only message in thread
From: Stephen Gildea @ 2024-12-21 16:53 UTC (permalink / raw)
To: emacs-devel
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2024-12-21 16:53 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-21 16:53 a property "definition-type" would help find macro-defined tests Stephen Gildea
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.