From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#62371: [PATCH] Fix go-ts-mode incorrect docstring inserted for methods Date: Sun, 26 Mar 2023 07:34:00 +0300 Message-ID: <838rfkb07b.fsf@gnu.org> References: <83o7ohc9eb.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8797"; mail-complaints-to="usenet@ciao.gmane.io" Cc: casouri@gmail.com, 62371@debbugs.gnu.org, dgutov@yandex.ru To: evgeni.d.kolev@gmail.com, Randy Taylor Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Mar 26 06:35:25 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 1pgI6G-0001xO-KJ for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 26 Mar 2023 06:35:24 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pgI62-0005Gg-2n; Sun, 26 Mar 2023 00:35: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 1pgI5z-0005Eg-OE for bug-gnu-emacs@gnu.org; Sun, 26 Mar 2023 00:35:07 -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 1pgI5u-0000zC-ME for bug-gnu-emacs@gnu.org; Sun, 26 Mar 2023 00:35:07 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pgI5u-0008FW-8N for bug-gnu-emacs@gnu.org; Sun, 26 Mar 2023 00:35:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 26 Mar 2023 04:35:02 +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.167980525131648 (code B ref 62371); Sun, 26 Mar 2023 04:35:02 +0000 Original-Received: (at 62371) by debbugs.gnu.org; 26 Mar 2023 04:34:11 +0000 Original-Received: from localhost ([127.0.0.1]:43799 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pgI55-0008EN-5v for submit@debbugs.gnu.org; Sun, 26 Mar 2023 00:34:11 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:55952) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pgI52-0008E7-Ln for 62371@debbugs.gnu.org; Sun, 26 Mar 2023 00:34:09 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pgI4w-0008VQ-HU; Sun, 26 Mar 2023 00:34:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=/XHvvVrKFBoKc7V4yYTASk5imccQcQoFm8sZOEVgdYQ=; b=rjnxBp14LgtP RykaLmT13WrEol+mZVJuf0u7GR6CCWUYQIHpxlA0jM3tD8iiSmWvJnmZT/qsZk8Ne/TrHTeVtQtTA rAgTV9qiqWWRX+fN9qRfeGyn5co6WggyYNNeMRN1/ydHVcZ/ZGZj3QyS/zGQ8hSGcBI+78kEd35Yy mGq+7hvR2pVRrTUYAYC6mPiMvS5E7Nkeg5PJWaeEkyT9A1LOQL9HnQk9rvLTr407Ca8nNi+VhkG38 3xBBXhAEGwbyKjXpKx3rq5vaMhVprjeF9lIZiLZnqeMY+DgEV0HBUzCpg2Izl+0OaKh4P3PvT3tDZ 2dp9wSa0a3y2cWHPjo97Kw==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pgI4u-00024X-Ku; Sun, 26 Mar 2023 00:34:02 -0400 In-Reply-To: (message from Randy Taylor on Sat, 25 Mar 2023 19:37:17 +0000) 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:258647 Archived-At: > Date: Sat, 25 Mar 2023 19:37:17 +0000 > From: Randy Taylor > Cc: Evgeni Kolev , Dmitry Gutov , Yuan Fu , 62371@debbugs.gnu.org > > On Saturday, March 25th, 2023 at 08:17, Eli Zaretskii wrote: > > > > > From: Evgeni Kolev evgeni.d.kolev@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?