GNU bug report logs - #62371
[PATCH] Fix go-ts-mode incorrect docstring inserted for methods

Previous Next

Package: emacs;

Reported by: Evgeni Kolev <evgeni.d.kolev <at> gmail.com>

Date: Wed, 22 Mar 2023 08:07:01 UTC

Severity: normal

Tags: patch

Done: Eli Zaretskii <eliz <at> gnu.org>

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 62371 in the body.
You can then email your comments to 62371 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#62371; Package emacs. (Wed, 22 Mar 2023 08:07:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Evgeni Kolev <evgeni.d.kolev <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 22 Mar 2023 08:07:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Evgeni Kolev <evgeni.d.kolev <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Fix go-ts-mode incorrect docstring inserted for methods
Date: Wed, 22 Mar 2023 10:05:56 +0200
[Message part 1 (text/plain, inline)]
The docstring inserted with go-ts-mode's C-c C-d was incorrectly
prefixed with the receiver "(myStruct).":

    // (myStruct).act
    func (m *myStruct) act () {...}

The above docstring is not correct because the receiver "myStruct"
should not be in the docstring.

The issue is caused by imenu and go-ts-mode--defun-name using the same
code to determine the defun name. Instead, they should produce
different results - imenu should show the "myStruct" prefix, but the
docstring should not.

This commit fixes the incorrect behavior by introducing an optional
SKIP-PREFIX parameter to (go-ts-mode--defun-name). Pressing C-c C-d
now inserts just the method name:

    // act
    func (m *myStruct) act () {...}

* lisp/progmodes/go-ts-mode.el (go-ts-mode--defun-name): New optional
parameter SKIP-PREFIX. (go-ts-mode-docstring):
Call (go-ts-mode--defun-name t) instead of (treesit-defun-name).
[0001-Fix-go-ts-mode-incorrect-docstring-inserted-for-meth.patch (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62371; Package emacs. (Fri, 24 Mar 2023 18:22:02 GMT) Full text and rfc822 format available.

Message #8 received at 62371 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: evgeni.d.kolev <at> gmail.com
Cc: Randy Taylor <dev <at> rjt.dev>, 62371 <at> debbugs.gnu.org
Subject: Re: bug#62371: [PATCH] Fix go-ts-mode incorrect docstring inserted 
 for methods
Date: Fri, 24 Mar 2023 11:21:38 -0700
Evgeni Kolev <evgeni.d.kolev <at> gmail.com> writes:

> The docstring inserted with go-ts-mode's C-c C-d was incorrectly
> prefixed with the receiver "(myStruct).":
>
>     // (myStruct).act
>     func (m *myStruct) act () {...}
>
> The above docstring is not correct because the receiver "myStruct"
> should not be in the docstring.
>
> The issue is caused by imenu and go-ts-mode--defun-name using the same
> code to determine the defun name. Instead, they should produce
> different results - imenu should show the "myStruct" prefix, but the
> docstring should not.
>
> This commit fixes the incorrect behavior by introducing an optional
> SKIP-PREFIX parameter to (go-ts-mode--defun-name). Pressing C-c C-d
> now inserts just the method name:
>
>     // act
>     func (m *myStruct) act () {...}
>

Thanks! CC’ing Randy.

Yuan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62371; Package emacs. (Sat, 25 Mar 2023 00:59:02 GMT) Full text and rfc822 format available.

Message #11 received at 62371 <at> debbugs.gnu.org (full text, mbox):

From: Randy Taylor <dev <at> rjt.dev>
To: Yuan Fu <casouri <at> gmail.com>
Cc: evgeni.d.kolev <at> gmail.com, 62371 <at> debbugs.gnu.org
Subject: Re: bug#62371: [PATCH] Fix go-ts-mode incorrect docstring inserted
 for methods
Date: Sat, 25 Mar 2023 00:58:09 +0000
On Friday, March 24th, 2023 at 14:21, Yuan Fu <casouri <at> gmail.com> wrote: 
> Evgeni Kolev evgeni.d.kolev <at> gmail.com writes:
> 
> > The docstring inserted with go-ts-mode's C-c C-d was incorrectly
> > prefixed with the receiver "(myStruct).":
> > 
> > // (myStruct).act
> > func (m *myStruct) act () {...}
> > 
> > The above docstring is not correct because the receiver "myStruct"
> > should not be in the docstring.
> > 
> > The issue is caused by imenu and go-ts-mode--defun-name using the same
> > code to determine the defun name. Instead, they should produce
> > different results - imenu should show the "myStruct" prefix, but the
> > docstring should not.
> > 
> > This commit fixes the incorrect behavior by introducing an optional
> > SKIP-PREFIX parameter to (go-ts-mode--defun-name). Pressing C-c C-d
> > now inserts just the method name:
> > 
> > // act
> > func (m *myStruct) act () {...}
> 
> 
> Thanks! CC’ing Randy.
> 
> Yuan
> 

Thanks, I was going to look yesterday but I forgot :D.

Looks good to me!




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62371; Package emacs. (Sat, 25 Mar 2023 12:18:01 GMT) Full text and rfc822 format available.

Message #14 received at 62371 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Evgeni Kolev <evgeni.d.kolev <at> gmail.com>, Randy Taylor <dev <at> rjt.dev>,
 Dmitry Gutov <dgutov <at> yandex.ru>, Yuan Fu <casouri <at> gmail.com>
Cc: 62371 <at> debbugs.gnu.org
Subject: Re: bug#62371: [PATCH] Fix go-ts-mode incorrect docstring inserted for
 methods
Date: Sat, 25 Mar 2023 15:17:48 +0300
> From: Evgeni Kolev <evgeni.d.kolev <at> gmail.com>
> Date: Wed, 22 Mar 2023 10:05:56 +0200
> 
> The docstring inserted with go-ts-mode's C-c C-d was incorrectly
> prefixed with the receiver "(myStruct).":
> 
>     // (myStruct).act
>     func (m *myStruct) act () {...}
> 
> The above docstring is not correct because the receiver "myStruct"
> should not be in the docstring.
> 
> The issue is caused by imenu and go-ts-mode--defun-name using the same
> code to determine the defun name. Instead, they should produce
> different results - imenu should show the "myStruct" prefix, but the
> docstring should not.
> 
> This commit fixes the incorrect behavior by introducing an optional
> SKIP-PREFIX parameter to (go-ts-mode--defun-name). Pressing C-c C-d
> now inserts just the method name:
> 
>     // act
>     func (m *myStruct) act () {...}
> 
> * lisp/progmodes/go-ts-mode.el (go-ts-mode--defun-name): New optional
> parameter SKIP-PREFIX. (go-ts-mode-docstring):
> Call (go-ts-mode--defun-name t) instead of (treesit-defun-name).

Thanks.

Dmitry, Yuan, Randy: any comments?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62371; Package emacs. (Sat, 25 Mar 2023 19:38:01 GMT) Full text and rfc822 format available.

Message #17 received at 62371 <at> debbugs.gnu.org (full text, mbox):

From: Randy Taylor <dev <at> rjt.dev>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Evgeni Kolev <evgeni.d.kolev <at> gmail.com>, 62371 <at> debbugs.gnu.org,
 Yuan Fu <casouri <at> gmail.com>, Dmitry Gutov <dgutov <at> yandex.ru>
Subject: Re: bug#62371: [PATCH] Fix go-ts-mode incorrect docstring inserted
 for methods
Date: Sat, 25 Mar 2023 19:37:17 +0000
On Saturday, March 25th, 2023 at 08:17, Eli Zaretskii <eliz <at> gnu.org> wrote:
> 
> > From: Evgeni Kolev evgeni.d.kolev <at> gmail.com
> 
> > Date: Wed, 22 Mar 2023 10:05:56 +0200
> > 
> > The docstring inserted with go-ts-mode's C-c C-d was incorrectly
> > prefixed with the receiver "(myStruct).":
> > 
> > // (myStruct).act
> > func (m *myStruct) act () {...}
> > 
> > The above docstring is not correct because the receiver "myStruct"
> > should not be in the docstring.
> > 
> > The issue is caused by imenu and go-ts-mode--defun-name using the same
> > code to determine the defun name. Instead, they should produce
> > different results - imenu should show the "myStruct" prefix, but the
> > docstring should not.
> > 
> > This commit fixes the incorrect behavior by introducing an optional
> > SKIP-PREFIX parameter to (go-ts-mode--defun-name). Pressing C-c C-d
> > now inserts just the method name:
> > 
> > // act
> > func (m *myStruct) act () {...}
> > 
> > * lisp/progmodes/go-ts-mode.el (go-ts-mode--defun-name): New optional
> > parameter SKIP-PREFIX. (go-ts-mode-docstring):
> > Call (go-ts-mode--defun-name t) instead of (treesit-defun-name).
> 
> 
> Thanks.
> 
> Dmitry, Yuan, Randy: any comments?

I guess my email yesterday didn't make it through or got missed?

It looks good to me, feel free to install.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62371; Package emacs. (Sun, 26 Mar 2023 01:57:02 GMT) Full text and rfc822 format available.

Message #20 received at 62371 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Eli Zaretskii <eliz <at> gnu.org>, Evgeni Kolev <evgeni.d.kolev <at> gmail.com>,
 Randy Taylor <dev <at> rjt.dev>, Yuan Fu <casouri <at> gmail.com>
Cc: 62371 <at> debbugs.gnu.org
Subject: Re: bug#62371: [PATCH] Fix go-ts-mode incorrect docstring inserted
 for methods
Date: Sun, 26 Mar 2023 04:56:25 +0300
On 25/03/2023 14:17, Eli Zaretskii wrote:
> Dmitry, Yuan, Randy: any comments?

It also looks good to me. The commit message might be a little too 
verbose, though -- what do you think?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62371; Package emacs. (Sun, 26 Mar 2023 04:35:02 GMT) Full text and rfc822 format available.

Message #23 received at 62371 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: evgeni.d.kolev <at> gmail.com, Randy Taylor <dev <at> rjt.dev>
Cc: casouri <at> gmail.com, 62371 <at> debbugs.gnu.org, dgutov <at> yandex.ru
Subject: Re: bug#62371: [PATCH] Fix go-ts-mode incorrect docstring inserted
 for methods
Date: Sun, 26 Mar 2023 07:34:00 +0300
> Date: Sat, 25 Mar 2023 19:37:17 +0000
> From: Randy Taylor <dev <at> rjt.dev>
> Cc: Evgeni Kolev <evgeni.d.kolev <at> gmail.com>, Dmitry Gutov <dgutov <at> yandex.ru>, Yuan Fu <casouri <at> gmail.com>, 62371 <at> debbugs.gnu.org
> 
> On Saturday, March 25th, 2023 at 08:17, Eli Zaretskii <eliz <at> gnu.org> wrote:
> > 
> > > From: Evgeni Kolev evgeni.d.kolev <at> gmail.com
> > 
> > > Date: Wed, 22 Mar 2023 10:05:56 +0200
> > > 
> > > The docstring inserted with go-ts-mode's C-c C-d was incorrectly
> > > prefixed with the receiver "(myStruct).":
> > > 
> > > // (myStruct).act
> > > func (m *myStruct) act () {...}
> > > 
> > > The above docstring is not correct because the receiver "myStruct"
> > > should not be in the docstring.
> > > 
> > > The issue is caused by imenu and go-ts-mode--defun-name using the same
> > > code to determine the defun name. Instead, they should produce
> > > different results - imenu should show the "myStruct" prefix, but the
> > > docstring should not.
> > > 
> > > This commit fixes the incorrect behavior by introducing an optional
> > > SKIP-PREFIX parameter to (go-ts-mode--defun-name). Pressing C-c C-d
> > > now inserts just the method name:
> > > 
> > > // act
> > > func (m *myStruct) act () {...}
> > > 
> > > * lisp/progmodes/go-ts-mode.el (go-ts-mode--defun-name): New optional
> > > parameter SKIP-PREFIX. (go-ts-mode-docstring):
> > > Call (go-ts-mode--defun-name t) instead of (treesit-defun-name).
> > 
> > 
> > Thanks.
> > 
> > Dmitry, Yuan, Randy: any comments?
> 
> I guess my email yesterday didn't make it through or got missed?

It didn't.  But gnu.org had severe DNS problems all day yesterday, so
many email messages were delivered with a long delay.  I wrote the
above before I saw your response.

> It looks good to me, feel free to install.

I tried, but it failed to apply.  Evgeni, could you please resubmit,
relative to the emacs-29 branch?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62371; Package emacs. (Sun, 26 Mar 2023 05:23:01 GMT) Full text and rfc822 format available.

Message #26 received at 62371 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: dev <at> rjt.dev, evgeni.d.kolev <at> gmail.com, 62371 <at> debbugs.gnu.org,
 casouri <at> gmail.com
Subject: Re: bug#62371: [PATCH] Fix go-ts-mode incorrect docstring inserted
 for methods
Date: Sun, 26 Mar 2023 08:22:49 +0300
> Date: Sun, 26 Mar 2023 04:56:25 +0300
> Cc: 62371 <at> debbugs.gnu.org
> From: Dmitry Gutov <dgutov <at> yandex.ru>
> 
> On 25/03/2023 14:17, Eli Zaretskii wrote:
> > Dmitry, Yuan, Randy: any comments?
> 
> It also looks good to me. The commit message might be a little too 
> verbose, though -- what do you think?

It could use some editing, yes.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62371; Package emacs. (Sun, 26 Mar 2023 11:45:01 GMT) Full text and rfc822 format available.

Message #29 received at 62371 <at> debbugs.gnu.org (full text, mbox):

From: Randy Taylor <dev <at> rjt.dev>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: evgeni.d.kolev <at> gmail.com, 62371 <at> debbugs.gnu.org, casouri <at> gmail.com,
 dgutov <at> yandex.ru
Subject: Re: bug#62371: [PATCH] Fix go-ts-mode incorrect docstring inserted
 for methods
Date: Sun, 26 Mar 2023 11:44:05 +0000
On Sunday, March 26th, 2023 at 00:34, Eli Zaretskii <eliz <at> gnu.org> wrote:
> > Date: Sat, 25 Mar 2023 19:37:17 +0000
> 
> > From: Randy Taylor dev <at> rjt.dev
> > Cc: Evgeni Kolev evgeni.d.kolev <at> gmail.com, Dmitry Gutov dgutov <at> yandex.ru, Yuan Fu casouri <at> gmail.com, 62371 <at> debbugs.gnu.org
> > 
> > On Saturday, March 25th, 2023 at 08:17, Eli Zaretskii eliz <at> gnu.org wrote:
> > 
> > > > From: Evgeni Kolev evgeni.d.kolev <at> gmail.com
> > > 
> > > > Date: Wed, 22 Mar 2023 10:05:56 +0200
> > > > 
> > > > The docstring inserted with go-ts-mode's C-c C-d was incorrectly
> > > > prefixed with the receiver "(myStruct).":
> > > > 
> > > > // (myStruct).act
> > > > func (m *myStruct) act () {...}
> > > > 
> > > > The above docstring is not correct because the receiver "myStruct"
> > > > should not be in the docstring.
> > > > 
> > > > The issue is caused by imenu and go-ts-mode--defun-name using the same
> > > > code to determine the defun name. Instead, they should produce
> > > > different results - imenu should show the "myStruct" prefix, but the
> > > > docstring should not.
> > > > 
> > > > This commit fixes the incorrect behavior by introducing an optional
> > > > SKIP-PREFIX parameter to (go-ts-mode--defun-name). Pressing C-c C-d
> > > > now inserts just the method name:
> > > > 
> > > > // act
> > > > func (m *myStruct) act () {...}
> > > > 
> > > > * lisp/progmodes/go-ts-mode.el (go-ts-mode--defun-name): New optional
> > > > parameter SKIP-PREFIX. (go-ts-mode-docstring):
> > > > Call (go-ts-mode--defun-name t) instead of (treesit-defun-name).
> > > 
> > > Thanks.
> > > 
> > > Dmitry, Yuan, Randy: any comments?
> > 
> > I guess my email yesterday didn't make it through or got missed?
> 
> 
> It didn't. But gnu.org had severe DNS problems all day yesterday, so
> many email messages were delivered with a long delay. I wrote the
> above before I saw your response.
> 
> > It looks good to me, feel free to install.
> 
> 
> I tried, but it failed to apply. Evgeni, could you please resubmit,
> relative to the emacs-29 branch?

It's for master, this feature didn't make it in to emacs-29.




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sun, 26 Mar 2023 12:06:02 GMT) Full text and rfc822 format available.

Notification sent to Evgeni Kolev <evgeni.d.kolev <at> gmail.com>:
bug acknowledged by developer. (Sun, 26 Mar 2023 12:06:02 GMT) Full text and rfc822 format available.

Message #34 received at 62371-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Randy Taylor <dev <at> rjt.dev>
Cc: evgeni.d.kolev <at> gmail.com, 62371-done <at> debbugs.gnu.org, casouri <at> gmail.com,
 dgutov <at> yandex.ru
Subject: Re: bug#62371: [PATCH] Fix go-ts-mode incorrect docstring inserted
 for methods
Date: Sun, 26 Mar 2023 15:05:48 +0300
> Date: Sun, 26 Mar 2023 11:44:05 +0000
> From: Randy Taylor <dev <at> rjt.dev>
> Cc: evgeni.d.kolev <at> gmail.com, dgutov <at> yandex.ru, casouri <at> gmail.com, 62371 <at> debbugs.gnu.org
> 
> > > It looks good to me, feel free to install.
> > 
> > 
> > I tried, but it failed to apply. Evgeni, could you please resubmit,
> > relative to the emacs-29 branch?
> 
> It's for master, this feature didn't make it in to emacs-29.

Thanks, now installed on master, and closing the bug.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62371; Package emacs. (Mon, 27 Mar 2023 10:06:01 GMT) Full text and rfc822 format available.

Message #37 received at 62371-done <at> debbugs.gnu.org (full text, mbox):

From: Evgeni Kolev <evgenysw <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Randy Taylor <dev <at> rjt.dev>, casouri <at> gmail.com, 62371-done <at> debbugs.gnu.org,
 dgutov <at> yandex.ru
Subject: Re: bug#62371: [PATCH] Fix go-ts-mode incorrect docstring inserted
 for methods
Date: Mon, 27 Mar 2023 13:04:28 +0300
Thank you Eli, and everyone else!

The patch was meant for master, not emacs-29 - I should have stated
this. I also incorrectly sent the patch from my alternate mail
address, but the email in the patch was correct, so no harm done.
Thanks again!

On Sun, Mar 26, 2023 at 3:05 PM Eli Zaretskii <eliz <at> gnu.org> wrote:
>
> > Date: Sun, 26 Mar 2023 11:44:05 +0000
> > From: Randy Taylor <dev <at> rjt.dev>
> > Cc: evgeni.d.kolev <at> gmail.com, dgutov <at> yandex.ru, casouri <at> gmail.com, 62371 <at> debbugs.gnu.org
> >
> > > > It looks good to me, feel free to install.
> > >
> > >
> > > I tried, but it failed to apply. Evgeni, could you please resubmit,
> > > relative to the emacs-29 branch?
> >
> > It's for master, this feature didn't make it in to emacs-29.
>
> Thanks, now installed on master, and closing the bug.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 24 Apr 2023 11:24:11 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.