GNU bug report logs -
#60025
[PATCH] Add go-ts-mode and go-mod-ts-mode
Previous Next
Reported by: Randy Taylor <dev <at> rjt.dev>
Date: Tue, 13 Dec 2022 02:15:01 UTC
Severity: normal
Tags: patch
Done: Randy Taylor <dev <at> rjt.dev>
Bug is archived. No further changes may be made.
Full log
Message #35 received at 60025 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On Wednesday, December 14th, 2022 at 16:27, Theodor Thornhill <theo <at> thornhill.no> wrote:
>
> Yeah, I seem to remember seeing these \n nodes in the go-mode I made
> some time ago. There is no node there, so no-node is the rule that
> matches, as there is no parent. I believe you can solve it with
> something like
>
>
> (defun go-backward-up-list ()
> (lambda (node parent bol &rest _)
> (save-excursion
> (backward-up-list 1 nil t)
> (back-to-indentation)
> (point))))
>
> and use some variant of that. Now you can find a different node without
> relying on there being a node where you start.
Thanks Theo, that worked perfectly. We should consider adding something like this to the documentation somewhere, since I didn't see anything like this anywhere (although maybe I missed it).
New patch attached with the following changes:
- go-mod-ts-mode--indent-rules modified to utilize the new function to check if in a directive, and if so, indent appropriately.
- New function go-mod-ts-mode--in-directive-p that checks if we're in a directive.
- I'm no elisp guru, so there may (probably) be a better way to do what I did. Happy to improve it (and the name and docstring, too).
Otherwise, feel free to install it.
[0001-Add-go-ts-mode-and-go-mod-ts-mode-Bug-60025.patch (text/x-patch, attachment)]
This bug report was last modified 2 years and 215 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.