From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Randy Taylor Newsgroups: gmane.emacs.bugs Subject: bug#62371: [PATCH] Fix go-ts-mode incorrect docstring inserted for methods Date: Sun, 26 Mar 2023 11:44:05 +0000 Message-ID: <9M0ZWnOKfTsq_wcsd-YSG8IwTZiVeTX0qroEGvW3kceThXh65Ok1dPpt2gcbaYS6jayromU9F6PdEetzpqht_nDN55fI_HAkrjtQMT0rQgI=@rjt.dev> References: <83o7ohc9eb.fsf@gnu.org> <838rfkb07b.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30405"; mail-complaints-to="usenet@ciao.gmane.io" Cc: evgeni.d.kolev@gmail.com, 62371@debbugs.gnu.org, casouri@gmail.com, dgutov@yandex.ru To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Mar 26 13:45:22 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1pgOoL-0007e7-Qo for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 26 Mar 2023 13:45:22 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pgOo9-0006o8-3S; Sun, 26 Mar 2023 07:45:10 -0400 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 1pgOo2-0006nj-7L for bug-gnu-emacs@gnu.org; Sun, 26 Mar 2023 07:45:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pgOo1-0004tI-Tk for bug-gnu-emacs@gnu.org; Sun, 26 Mar 2023 07:45:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pgOo1-0006CD-Oc for bug-gnu-emacs@gnu.org; Sun, 26 Mar 2023 07:45:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Randy Taylor Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 26 Mar 2023 11:45:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62371 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 62371-submit@debbugs.gnu.org id=B62371.167983106223730 (code B ref 62371); Sun, 26 Mar 2023 11:45:01 +0000 Original-Received: (at 62371) by debbugs.gnu.org; 26 Mar 2023 11:44:22 +0000 Original-Received: from localhost ([127.0.0.1]:44176 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pgOnO-0006Ag-Cz for submit@debbugs.gnu.org; Sun, 26 Mar 2023 07:44:22 -0400 Original-Received: from mail-4323.proton.ch ([185.70.43.23]:59839) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pgOnM-0006AQ-A7 for 62371@debbugs.gnu.org; Sun, 26 Mar 2023 07:44:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rjt.dev; s=protonmail3; t=1679831053; x=1680090253; bh=//oIxzRbR82YISVq5e7BVhm9cpDxSOS3XrlAh1dR98U=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=Gd79SoXV2owvUx5rOfVzwf2XaN/5vj+rp+x7OFbUIpsZylXhp2Isoz+rByH7bLDUT vCMCrJ9nJ3JCBO1gD2/3AjGHfEo3gmwz2TjxqAMMRxNdLMlA3ELIn3lg16vA7xnvGP giWEGCwbM+9gDMsZHaNsOExgmQCxKhCzdoTwo7PU22CursMLLYE/qzQINFWAK90Ns3 XRYnFl+R44pN1xz4DMe8pTVYZh5lGoBW9OZLLOS4vU/jH5M3XC0IHLxkn9/bmhqNWw 7WipNuIO8967z8FwPNYynIHWQwqktGfocheiOMECwtv+lWlNPTl7agzyAWEUIqrZh3 B3HNn5TogACtQ== In-Reply-To: <838rfkb07b.fsf@gnu.org> Feedback-ID: 44397038:user:proton X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:258670 Archived-At: On Sunday, March 26th, 2023 at 00:34, Eli Zaretskii wrote: > > Date: Sat, 25 Mar 2023 19:37:17 +0000 >=20 > > From: Randy Taylor dev@rjt.dev > > Cc: Evgeni Kolev evgeni.d.kolev@gmail.com, Dmitry Gutov dgutov@yandex.r= u, Yuan Fu casouri@gmail.com, 62371@debbugs.gnu.org > >=20 > > On Saturday, March 25th, 2023 at 08:17, Eli Zaretskii eliz@gnu.org wrot= e: > >=20 > > > > From: Evgeni Kolev evgeni.d.kolev@gmail.com > > >=20 > > > > Date: Wed, 22 Mar 2023 10:05:56 +0200 > > > >=20 > > > > The docstring inserted with go-ts-mode's C-c C-d was incorrectly > > > > prefixed with the receiver "(myStruct).": > > > >=20 > > > > // (myStruct).act > > > > func (m *myStruct) act () {...} > > > >=20 > > > > The above docstring is not correct because the receiver "myStruct" > > > > should not be in the docstring. > > > >=20 > > > > The issue is caused by imenu and go-ts-mode--defun-name using the s= ame > > > > code to determine the defun name. Instead, they should produce > > > > different results - imenu should show the "myStruct" prefix, but th= e > > > > docstring should not. > > > >=20 > > > > 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: > > > >=20 > > > > // act > > > > func (m *myStruct) act () {...} > > > >=20 > > > > * lisp/progmodes/go-ts-mode.el (go-ts-mode--defun-name): New option= al > > > > parameter SKIP-PREFIX. (go-ts-mode-docstring): > > > > Call (go-ts-mode--defun-name t) instead of (treesit-defun-name). > > >=20 > > > Thanks. > > >=20 > > > Dmitry, Yuan, Randy: any comments? > >=20 > > I guess my email yesterday didn't make it through or got missed? >=20 >=20 > 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. >=20 > > It looks good to me, feel free to install. >=20 >=20 > 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.