all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eshel Yaron via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Evgeni Kolev <evgenysw@gmail.com>
Cc: Randy Taylor <dev@rjt.dev>, Eli Zaretskii <eliz@gnu.org>,
	60805@debbugs.gnu.org, Theodor Thornhill <theo@thornhill.no>
Subject: bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to function
Date: Sat, 21 Jan 2023 23:26:23 +0200	[thread overview]
Message-ID: <m14jsj1sw0.fsf@gmail.com> (raw)
In-Reply-To: <CAMCrgaU4ED9LAyu=mhG+Y32nTfvFV1Sj9GDO_ObLKifOO3jcsA@mail.gmail.com> (Evgeni Kolev's message of "Sat, 21 Jan 2023 16:39:12 +0200")

Evgeni Kolev <evgenysw@gmail.com> 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





  parent reply	other threads:[~2023-01-21 21:26 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-14  6:45 bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to function Evgeni Kolev
2023-01-14  7:48 ` Eli Zaretskii
2023-01-14 11:43   ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-14 12:24     ` Eli Zaretskii
2023-01-14 13:08       ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-18  6:26         ` Evgeni Kolev
2023-01-18 11:59           ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-20  9:41             ` Evgeni Kolev
2023-01-20 10:14               ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-20 11:39                 ` Evgeni Kolev
2023-01-20 14:56                   ` Evgeni Kolev
2023-01-20 20:39                     ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-21  3:30                       ` Randy Taylor
2023-01-21  6:48                         ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-21  7:34                           ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-21 14:39                             ` Evgeni Kolev
2023-01-21 20:37                               ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-21 21:26                               ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-01-18  7:46       ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m14jsj1sw0.fsf@gmail.com \
    --to=bug-gnu-emacs@gnu.org \
    --cc=60805@debbugs.gnu.org \
    --cc=dev@rjt.dev \
    --cc=eliz@gnu.org \
    --cc=evgenysw@gmail.com \
    --cc=me@eshelyaron.com \
    --cc=theo@thornhill.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.