[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to fu
From: |
Evgeni Kolev |
Subject: |
bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to function |
Date: |
Fri, 20 Jan 2023 13:39:21 +0200 |
> In that case, maybe it is even simpler to do something like:
>
> (defun defun-comment-p ()
> (interactive)
> (save-restriction
> (narrow-to-defun t)
> (goto-char (point-min))
> (equal
> (treesit-node-type (treesit-node-at (point)))
> "comment")))
BTW I've noticed M-x mark-defun doesn't work correctly in some cases
with go-ts-mode (other *-gs-modes might also be affected, I haven't
tested). I wonder if narrow-to-defun could also be affected. For
example, with this Go code:
```
package main
func main() {
}
// some docstring
func main1() {
}
```
With the point in the body of "main1()", running M-x mark-defun marks
the blank line between the two functions instead of main1(). I'll
report this as a separate bug.
> However, now this code would act on code such as:
>
> ```
> //go:generate protoc .........
>
> // some docstring
> func main() {
>
> }
> ```
>
> And return point on the line with go:generate. Is that desired?
I'd prefer to _not_ add special handling for "//go:..." comments which
are somewhat rare and typically put on the very first line of the
file. For your particular example the point should be put on "// some
docstring" because there's a separating blank line. This is not the
behavior with my patch - I'll try to improve it.
> Should we bind something to the C-c prefix? I thought this was
> "user-reserved", so a user should bind them themselves.
I believe only "C-c letter" is user-reserved. I've drawn this
conclusion from here
https://www.gnu.org/software/emacs/manual/html_node/elisp/Key-Binding-Conventions.html
- bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to function, Evgeni Kolev, 2023/01/14
- bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to function, Eli Zaretskii, 2023/01/14
- bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to function, Theodor Thornhill, 2023/01/14
- bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to function, Eli Zaretskii, 2023/01/14
- bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to function, Theodor Thornhill, 2023/01/14
- bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to function, Evgeni Kolev, 2023/01/18
- bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to function, Theodor Thornhill, 2023/01/18
- bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to function, Evgeni Kolev, 2023/01/20
- bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to function, Theodor Thornhill, 2023/01/20
- bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to function,
Evgeni Kolev <=
- bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to function, Evgeni Kolev, 2023/01/20
- bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to function, Theodor Thornhill, 2023/01/20
- bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to function, Randy Taylor, 2023/01/20
- bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to function, Eshel Yaron, 2023/01/21
- bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to function, Theodor Thornhill, 2023/01/21
- bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to function, Evgeni Kolev, 2023/01/21
- bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to function, Theodor Thornhill, 2023/01/21
- bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to function, Eshel Yaron, 2023/01/21
- bug#60805: [PATCH] Extend go-ts-mode with command to add docstring to function, Eshel Yaron, 2023/01/18