[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: a property "definition-type" would help find macro-defined tests
From: |
Richard Lawrence |
Subject: |
Re: a property "definition-type" would help find macro-defined tests |
Date: |
Sun, 22 Dec 2024 18:12:59 +0100 |
Stephen Gildea <stepheng+emacs@gildea.com> writes:
> 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.
> ...
> Does this seem like a generally useful addition?
As someone who's recently written a macro to define a bunch of tests,
and was then mildly frustrated that e.g.
ert-results-pop-to-should-forms-for-test-at-point didn't even come close
to finding the definitions, something like this sounds useful to me!
I wonder if there isn't already some better way to do this, though, that
find-function-search-for-symbol could make use of. I got curious and
briefly went down a rabbit hole looking for one, since there are
functions like `symbol-file' and the intriguing `symbol-with-pos-pos'.
The latter extracts a position from a mysterious-to-me entity called a
"symbol with position". Perhaps there's *already* a standard way to tag
a symbol with a position in a source file somehow, and what's needed is
to encourage macro writers to use it, and to adjust the find-function*
functions to look for it? Someone who knows more than me about Emacs
internals could shed more light here...but anyway, if there isn't, I
like the idea!
Best,
Richard