GNU bug report logs -
#61640
30.0.50; Help Elisp xref recognize defclass parent classes
Previous Next
Reported by: Eric Abrahamsen <eric <at> ericabrahamsen.net>
Date: Sun, 19 Feb 2023 22:09:01 UTC
Severity: normal
Found in version 30.0.50
Fixed in version 30.1
Done: Dmitry Gutov <dgutov <at> yandex.ru>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 61640 in the body.
You can then email your comments to 61640 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#61640
; Package
emacs
.
(Sun, 19 Feb 2023 22:09:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Eric Abrahamsen <eric <at> ericabrahamsen.net>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sun, 19 Feb 2023 22:09:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
In a form such as this:
(defclass ebdb-field-id (ebdb-field-labeled ebdb-field-obfuscated ebdb-field-user)
((label-list :initform 'ebdb-id-label-list)
...
))
All the symbols in
(ebdb-field-labeled ebdb-field-obfuscated ebdb-field-user)
should be recognized by `elisp--xref-infer-namespace' as 'function.
Right now, this is treated like a function call (ie like '(function
variable variable)).
I can't promise that the attached patch is exactly the right thing, but
it ought to be pretty close.
Thanks,
Eric
[elispxrefdefclass.diff (text/x-patch, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#61640
; Package
emacs
.
(Sun, 19 Feb 2023 22:43:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 61640 <at> debbugs.gnu.org (full text, mbox):
Hi!
On 20/02/2023 00:08, Eric Abrahamsen wrote:
> In a form such as this:
>
> (defclass ebdb-field-id (ebdb-field-labeled ebdb-field-obfuscated ebdb-field-user)
> ((label-list :initform 'ebdb-id-label-list)
> ...
> ))
>
> All the symbols in
>
> (ebdb-field-labeled ebdb-field-obfuscated ebdb-field-user)
>
> should be recognized by `elisp--xref-infer-namespace' as 'function.
> Right now, this is treated like a function call (ie like '(function
> variable variable)).
>
> I can't promise that the attached patch is exactly the right thing, but
> it ought to be pretty close.
Thanks for the patch. Could you try including a corresponding test?
There are examples in test/lisp/progmodes/elisp-mode-tests.el, see the
ones using the helper xref-elisp-deftest, starting with line 395.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#61640
; Package
emacs
.
(Sun, 19 Feb 2023 23:46:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 61640 <at> debbugs.gnu.org (full text, mbox):
Dmitry Gutov <dgutov <at> yandex.ru> writes:
> Hi!
>
> On 20/02/2023 00:08, Eric Abrahamsen wrote:
>> In a form such as this:
>> (defclass ebdb-field-id (ebdb-field-labeled ebdb-field-obfuscated
>> ebdb-field-user)
>> ((label-list :initform 'ebdb-id-label-list)
>> ...
>> ))
>> All the symbols in
>> (ebdb-field-labeled ebdb-field-obfuscated ebdb-field-user)
>> should be recognized by `elisp--xref-infer-namespace' as 'function.
>> Right now, this is treated like a function call (ie like '(function
>> variable variable)).
>> I can't promise that the attached patch is exactly the right thing,
>> but
>> it ought to be pretty close.
>
> Thanks for the patch. Could you try including a corresponding test?
>
> There are examples in test/lisp/progmodes/elisp-mode-tests.el, see the
> ones using the helper xref-elisp-deftest, starting with line 395.
There's a lot going on in there!
The tests using xref-elisp-deftest look like they're mostly aimed at
correctly finding definitions, which isn't the problem here: the
defclass is always found correctly *if* xref infers the namespace as
'function.
Shouldn't this instead be an addition to `elisp-mode-infer-namespace',
like with p8 below?
(elisp-mode-test--with-buffer
(concat "(list {p1}alpha {p2}beta)\n"
"(progn {p3}gamma {p4}delta)\n"
"(lambda ({p5}epsilon {p6}zeta) {p7}eta)\n"
"(defclass child-class (parent-1 {p8}parent-2)\n")
(should (equal (elisp--xref-infer-namespace p1) 'variable))
(should (equal (elisp--xref-infer-namespace p2) 'variable))
(should (equal (elisp--xref-infer-namespace p3) 'variable))
(should (equal (elisp--xref-infer-namespace p4) 'variable))
(should (equal (elisp--xref-infer-namespace p5) 'variable))
(should (equal (elisp--xref-infer-namespace p6) 'variable))
(should (equal (elisp--xref-infer-namespace p7) 'variable))
(should (equal (elisp--xref-infer-namespace p8) 'function)))
Obviously just guessing here...
Reply sent
to
Dmitry Gutov <dgutov <at> yandex.ru>
:
You have taken responsibility.
(Mon, 20 Feb 2023 01:06:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
Eric Abrahamsen <eric <at> ericabrahamsen.net>
:
bug acknowledged by developer.
(Mon, 20 Feb 2023 01:06:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 61640-done <at> debbugs.gnu.org (full text, mbox):
Version: 30.1
On 20/02/2023 01:45, Eric Abrahamsen wrote:
> Shouldn't this instead be an addition to `elisp-mode-infer-namespace',
> like with p8 below?
>
> (elisp-mode-test--with-buffer
> (concat "(list {p1}alpha {p2}beta)\n"
> "(progn {p3}gamma {p4}delta)\n"
> "(lambda ({p5}epsilon {p6}zeta) {p7}eta)\n"
> "(defclass child-class (parent-1 {p8}parent-2)\n")
> (should (equal (elisp--xref-infer-namespace p1) 'variable))
> (should (equal (elisp--xref-infer-namespace p2) 'variable))
> (should (equal (elisp--xref-infer-namespace p3) 'variable))
> (should (equal (elisp--xref-infer-namespace p4) 'variable))
> (should (equal (elisp--xref-infer-namespace p5) 'variable))
> (should (equal (elisp--xref-infer-namespace p6) 'variable))
> (should (equal (elisp--xref-infer-namespace p7) 'variable))
> (should (equal (elisp--xref-infer-namespace p8) 'function)))
>
> Obviously just guessing here...
It seems you're right, thanks.
I've put the test case separately and pushed the combined change to
master, commit cac13e36054.
That fixes the bug in my testing, but please do tell if something else
comes up.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#61640
; Package
emacs
.
(Mon, 20 Feb 2023 01:44:01 GMT)
Full text and
rfc822 format available.
Message #19 received at 61640 <at> debbugs.gnu.org (full text, mbox):
Dmitry Gutov <dgutov <at> yandex.ru> writes:
> Version: 30.1
>
> On 20/02/2023 01:45, Eric Abrahamsen wrote:
>> Shouldn't this instead be an addition to `elisp-mode-infer-namespace',
>> like with p8 below?
>> (elisp-mode-test--with-buffer
>> (concat "(list {p1}alpha {p2}beta)\n"
>> "(progn {p3}gamma {p4}delta)\n"
>> "(lambda ({p5}epsilon {p6}zeta) {p7}eta)\n"
>> "(defclass child-class (parent-1 {p8}parent-2)\n")
>> (should (equal (elisp--xref-infer-namespace p1) 'variable))
>> (should (equal (elisp--xref-infer-namespace p2) 'variable))
>> (should (equal (elisp--xref-infer-namespace p3) 'variable))
>> (should (equal (elisp--xref-infer-namespace p4) 'variable))
>> (should (equal (elisp--xref-infer-namespace p5) 'variable))
>> (should (equal (elisp--xref-infer-namespace p6) 'variable))
>> (should (equal (elisp--xref-infer-namespace p7) 'variable))
>> (should (equal (elisp--xref-infer-namespace p8) 'function)))
>> Obviously just guessing here...
>
> It seems you're right, thanks.
>
> I've put the test case separately and pushed the combined change to
> master, commit cac13e36054.
>
> That fixes the bug in my testing, but please do tell if something else
> comes up.
Thanks!
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 20 Mar 2023 11:24:09 GMT)
Full text and
rfc822 format available.
This bug report was last modified 2 years and 143 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.