From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#74461: [PATCH] Add go-work-ts-mode Date: Thu, 21 Nov 2024 18:02:50 +0200 Message-ID: <86a5dspob9.fsf@gnu.org> References: <877c8wvp34.fsf@disroot.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37539"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 74461@debbugs.gnu.org To: Gabriel Santos , Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Nov 21 17:03:16 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tE9eG-0009bu-DS for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 21 Nov 2024 17:03:16 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tE9e3-0006VT-2l; Thu, 21 Nov 2024 11:03:03 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tE9e2-0006VK-Fw for bug-gnu-emacs@gnu.org; Thu, 21 Nov 2024 11:03:02 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tE9e2-0005xu-6U for bug-gnu-emacs@gnu.org; Thu, 21 Nov 2024 11:03:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:From:Date:To:Subject; bh=SxKDYQlwgo6amBIBky9qu5PLOJH41CM2aPnSeulfqsU=; b=t5x8j/2ISm+BVF4flzjRE+kO8em97MXdeB/rM290Iz4UnaHNpgj/1MOkK1QTiAYZ0t7wfHqmuiUz/M7+XzwHz8HwoZRcEQPLrqS9QRVWCUBRzD/1VwEhHVthODEisU/CzsYVchsZCe0MSwGmj6kxNSdPlF2ld4q0WHDnL6DdJvE13I5aH6wA5Myfrt6T60gyal4u6P3sSxhedR+jUkT4mHHi6Buv/66MqknuMT7/PdHApmqxJDQMoh20vB2V1bWmXjgU0mgGh04bBAQBf67v+A351qKzmLOAkxUxWcuJ+by0FYUsK7F4Y/Sjtd6Yz2ZBmC+2d0ALlKMf20M5/VdRZA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tE9e2-0001eC-2L for bug-gnu-emacs@gnu.org; Thu, 21 Nov 2024 11:03:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 21 Nov 2024 16:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74461 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 74461-submit@debbugs.gnu.org id=B74461.17322049806325 (code B ref 74461); Thu, 21 Nov 2024 16:03:02 +0000 Original-Received: (at 74461) by debbugs.gnu.org; 21 Nov 2024 16:03:00 +0000 Original-Received: from localhost ([127.0.0.1]:51423 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tE9e0-0001dw-B2 for submit@debbugs.gnu.org; Thu, 21 Nov 2024 11:03:00 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:33514) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tE9dy-0001dg-T0 for 74461@debbugs.gnu.org; Thu, 21 Nov 2024 11:02:59 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tE9ds-0005w6-PM; Thu, 21 Nov 2024 11:02:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=SxKDYQlwgo6amBIBky9qu5PLOJH41CM2aPnSeulfqsU=; b=YsYWjUVTaYub ZrX5bvHB7XrOyVuwfOty5BNduJhXOx6uyWE+uTByeGrbzid6H9xq1DJmajA15MCliN1voULOeer2R +YDkIb7XNghQpz/3n5k4HcuDhR5C+xuxbMSkMi5e6DwC0dbiRMMzd/3xgkFqiCfOKyPYnS+iUceax +OR6GNxiRkgr4RVDWndkpWwYH/TbubHIVov++vJTN1Ecq58OnOEqg7F2mwot2ACA1ErjjtX2poCDg qOuGKBnbfy0gMxQW9aKZ8twW4uOHUGxhpubJhYS6pDKd7qsv3TdRlJcVIuD/2BmSPS3Nj8kpsFByi L9mKEFuA0T9ihiDsNjyxng==; In-Reply-To: <877c8wvp34.fsf@disroot.org> (bug-gnu-emacs@gnu.org) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:295734 Archived-At: > 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" > > 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?