From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eshel Yaron via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to function Date: Sat, 21 Jan 2023 23:26:23 +0200 Message-ID: References: <87sfgdtga2.fsf@thornhill.no> <875yd4njdc.fsf@thornhill.no> <87r0vpv7fp.fsf@thornhill.no> <87a62dkkj5.fsf@thornhill.no> Reply-To: Eshel Yaron Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29307"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Randy Taylor , Eli Zaretskii , 60805@debbugs.gnu.org, Theodor Thornhill To: Evgeni Kolev Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 21 22:27: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 1pJLOW-0007Mu-Nl for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 21 Jan 2023 22:27:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJLOC-0003Pk-Bc; Sat, 21 Jan 2023 16:27:04 -0500 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 1pJLOA-0003PO-Fh for bug-gnu-emacs@gnu.org; Sat, 21 Jan 2023 16:27:02 -0500 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 1pJLOA-0000M2-70 for bug-gnu-emacs@gnu.org; Sat, 21 Jan 2023 16:27:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pJLO9-0004Bp-NC for bug-gnu-emacs@gnu.org; Sat, 21 Jan 2023 16:27:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eshel Yaron Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 21 Jan 2023 21:27:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60805 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 60805-submit@debbugs.gnu.org id=B60805.167433639016065 (code B ref 60805); Sat, 21 Jan 2023 21:27:01 +0000 Original-Received: (at 60805) by debbugs.gnu.org; 21 Jan 2023 21:26:30 +0000 Original-Received: from localhost ([127.0.0.1]:49963 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pJLNe-0004B3-3Y for submit@debbugs.gnu.org; Sat, 21 Jan 2023 16:26:30 -0500 Original-Received: from mail.eshelyaron.com ([107.175.124.16]:35386 helo=eshelyaron.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pJLNc-0004Av-GR for 60805@debbugs.gnu.org; Sat, 21 Jan 2023 16:26:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com; s=mail; t=1674336388; bh=4b8NUS/BmzD+4Bc2G6wmRdqy1zdl0WpbF+aUjPA5qOk=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=jE0HSu9Ac0YrjwrM0XW1jRquGGm7RyZabxj8ykV55iY8zKyusD6C0gHxtGagcSw84 eI/4ppTTyW1oQPYHg2oHG2bU3RR+/Fose1wR1+9c822BevvbS93ckIcGbQ7/JR/Riz Xi6E5Tumj1zfiYgMUfKnMWqbkYYWKnrOcG27D2SsE7dnazwGRG5GejdHJlhz8WLTIU KWLB06Y6j6rdBxMdCi/xptJsso1qZrcMg2c41lSmyG+/GYD35M7xWvDU9yCT29jN3c Zn5WY/8SJ+7s4YEWLk+ICqiCe13MSlnT+ZVAWU2OVV0RPagt/asH/52O9plHX850tt eODtbnQrrv+UA== In-Reply-To: (Evgeni Kolev's message of "Sat, 21 Jan 2023 16:39:12 +0200") 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:253892 Archived-At: Evgeni Kolev writes: > While I agree users should be able to customize, this particular > example is too much of a corner case. > > For example, which Go functions/types need a docstring - all exported > ones, and possibly some unexported; on the other hand, adding linter > directives is so rare, you need to have a very good reason to add such > exceptions. Team-accepted exceptions are stored as accompanying config > files; example https://staticcheck.io/docs/configuration/#configuration-files > > We can add a variable holding a function which will take a defun > treesit node as input, and return text. It's simple from > implementation point of view. > > However, I don't see how this will make Emacs more useful - let's say > the user wants to enter a linter comment, will they: > 1. modify the customization variable to another function, then C-c > C-d, then revert the customization variable; or > 2. they can just enter the linter comment > > As long as entering linter comments is rare, I believe the user will just do 2. You don't need to modify the customization variable and restore it, you just need to define a specialized command that let-binds it and calls go-ts-mode-docstring. So I could have a custom command for directives or other formats that's as simple as: (defun my/go-insert-custom-docstring () (interactive) (let ((go-ts-mode-docstring-function #'my/go-custom-docstring)) (go-ts-mode-docstring))) With the current implementation, writing such a command would basically require duplicating the code of go-ts-mode-docstring expect for the part that inserts the Go function's name, right? That's not that such a big problem of course, but not ideal either IMO. Eshel