bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#60025: [PATCH] Add go-ts-mode and go-mod-ts-mode


From: Randy Taylor
Subject: bug#60025: [PATCH] Add go-ts-mode and go-mod-ts-mode
Date: Thu, 15 Dec 2022 02:15:59 +0000

On Wednesday, December 14th, 2022 at 16:27, Theodor Thornhill 
<theo@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.

Attachment: 0001-Add-go-ts-mode-and-go-mod-ts-mode-Bug-60025.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]