GNU bug report logs - #74461
[PATCH] Add go-work-ts-mode

Previous Next

Package: emacs;

Reported by: Gabriel Santos <gabrielsantosdesouza <at> disroot.org>

Date: Thu, 21 Nov 2024 13:59:02 UTC

Severity: wishlist

Tags: confirmed, patch

Fixed in version 31.1

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 74461 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Gabriel Santos <gabrielsantosdesouza <at> disroot.org>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 74461 <at> debbugs.gnu.org
Subject: Re: bug#74461: [PATCH] Add go-work-ts-mode
Date: Thu, 21 Nov 2024 18:02:50 +0200
> Date: Thu, 21 Nov 2024 07:49:35 -0300
> From:  Gabriel Santos via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> I wrote a tree-sitter mode after founding there wasn't one for Go
> Workspace files. I'd like to say thanks to Randy Taylor on his work to
> the Go tree-sitter mode, helped me a lot in this process.
> 
> Commit message:
> 
> * admin/notes/tree-sitter/build-module/batch.sh:
> * admin/notes/tree-sitter/build-module/build.sh: Add go-work support.
> * etc/NEWS: Mention go-work-ts-mode.
> * lisp/progmodes/eglot.el (eglot-server-programs): Add go-work-ts-mode.
> * lisp/progmodes/go-ts-mode: Add go-work-ts-mode for working with
> workspace files.
> 
> The parser can be found here:
> https://github.com/omertuc/tree-sitter-go-work

I think the parser URL should be mentioned in the comments in
go-ts-mode.el.

> I will mail my copyright assignment to the FSF still today.

Thanks.

> +---
> +** New major mode 'go-work-ts-mode'.
> +A major mode based on the tree-sitter library for editing "go.work"
> +files.  It is auto-enabled for files which are named "go.work".

The last sentence is factually inaccurate: the user needs to load
go-ts-mode to have this mode auto-enabled, right?

> +(defun go-work-ts-mode--in-directive-p ()
> +  "Return non-nil if point is inside a directive.

"inside a go-work directive", I presume?  IOW, the doc string's first
sentence sounds too general.

> +(if (treesit-ready-p 'gowork)
> +    (add-to-list 'auto-mode-alist '("/go\\.work\\'" . go-work-ts-mode)))

Wouldn't it be better to have this in the default value of
auto-mode-alist, just conditioned by (treesit-ready-p 'gowork) ?  That
way, loading go-ts-mode will not change auto-mode-alist.

Stefan, WDYT?




This bug report was last modified 103 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.