From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.bugs Subject: bug#70361: [PATCH] Add font-locking for operators in go-ts-mode. Date: Mon, 15 Apr 2024 22:57:43 -0700 Message-ID: References: Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32122"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 70361@debbugs.gnu.org, eliz@gnu.org To: Noah Peart Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Apr 16 07:59:18 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 1rwbqg-0008Dl-Du for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 16 Apr 2024 07:59:18 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rwbqH-00025g-Ig; Tue, 16 Apr 2024 01:58:53 -0400 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 1rwbqG-00025P-Lo for bug-gnu-emacs@gnu.org; Tue, 16 Apr 2024 01:58:52 -0400 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 1rwbqD-0008Rf-Q9 for bug-gnu-emacs@gnu.org; Tue, 16 Apr 2024 01:58:52 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rwbqP-000732-SB for bug-gnu-emacs@gnu.org; Tue, 16 Apr 2024 01:59:01 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 16 Apr 2024 05:59:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70361 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 70361-submit@debbugs.gnu.org id=B70361.171324709926754 (code B ref 70361); Tue, 16 Apr 2024 05:59:01 +0000 Original-Received: (at 70361) by debbugs.gnu.org; 16 Apr 2024 05:58:19 +0000 Original-Received: from localhost ([127.0.0.1]:41798 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rwbph-0006x4-8I for submit@debbugs.gnu.org; Tue, 16 Apr 2024 01:58:19 -0400 Original-Received: from mail-ua1-x92b.google.com ([2607:f8b0:4864:20::92b]:57806) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rwbpd-0006w7-45 for 70361@debbugs.gnu.org; Tue, 16 Apr 2024 01:58:15 -0400 Original-Received: by mail-ua1-x92b.google.com with SMTP id a1e0cc1a2514c-7e128b1ba75so1330804241.3 for <70361@debbugs.gnu.org>; Mon, 15 Apr 2024 22:58:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713247075; x=1713851875; darn=debbugs.gnu.org; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:from:to:cc:subject:date:message-id :reply-to; bh=R2m/EWf+tvoZGcAQbfSN+2bj51Z1l2ozNpflR0S5TY8=; b=V5WPeabT4PZzMqoLA5pJBL3F9BySG8kaVQ8OGz3rpPupsWszKvnl0ikGKgE5YLH4QM K6m78bErmCw9I9CvwDmCQO2ufNuGA22z6TvkqA3MuPv4WbwfLKnyol+mf2xiFDQproCF 3r6I3TPCBn8nWdq8HH7aDQ35IFFEpZBP/JrUJriazN6BqWG5UHbj9AxZtb/zjOLBA8/p VYJyq6MDKNuZlX0hCzqa9elgy/YxGa4+vNJpfrTp+QMA0USkPdE8ecUQ98/5iJ3V6CXw OVSk01fp49hsclRSvbYIRQmUa/L2mgGPgPlMndBpuN75x/oBv3t7mw5JLX71kMk+MUPa P2OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713247075; x=1713851875; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=R2m/EWf+tvoZGcAQbfSN+2bj51Z1l2ozNpflR0S5TY8=; b=Yi+zKSP+miVajsQ27rM+Dqm8NT16du76QDcrrtw1Rln6TZWFuug3Vq2HTVUXuEpE4n LnCYUVQwLudqv5N5GTReeuRSl1W/Mc9eZNaI8sKfQVn7l0UPvibHXhQIrPDoFIL/40uy M94HWSogRX4tqwjL+3JhPsAEzbs39eJW20s76JgB5pYazn7ErrVxJe0UU8T7Sv2TJ7Nw Bhe5qCv+COo516LdycYmjYPFCsD+QPvKGw86uHCpeHGVmo3WtgkW80qFecUwg6jmjxFF qYEjeK2JlQ8SjgFxR32PG2qcLtzvGAGL1540BNm78+Xd9D5ViaxILH+KcdSMMTnywNqi aP0A== X-Gm-Message-State: AOJu0Yx8xELZhaV6+3MEYZPwdVsQHqb554rO49GTn0QCOdS300mk5jKa KjWEmGFaCW9hcT5B7nVp2Y+zai1v8LVhtLqusMeTU4JjBZ3/tFGo X-Google-Smtp-Source: AGHT+IHlRlFeMSpTqnraLjnIKuClj1f6IFjJd+WRdYtrjDqqnH0OXTniet6ZlkDuojtvvCi5sSDdOA== X-Received: by 2002:a05:6102:160b:b0:479:d2ff:7cfb with SMTP id cu11-20020a056102160b00b00479d2ff7cfbmr14896012vsb.24.1713247075153; Mon, 15 Apr 2024 22:57:55 -0700 (PDT) Original-Received: from smtpclient.apple ([2601:641:300:4910:b0d6:b334:a9ae:40be]) by smtp.gmail.com with ESMTPSA id x30-20020a056a00189e00b006eaf43b5982sm3312964pfh.108.2024.04.15.22.57.53 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Apr 2024 22:57:54 -0700 (PDT) X-Mailer: Apple Mail (2.3731.700.6) 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:283406 Archived-At: Noah Peart writes: > Thankyou, this all makes sense. I do think it would be nice if it was = easier to somehow=20 > add user customizations to the font-locking, especially since it is so = easy to write tree-sitter > font-locking rules. Right. We (well, I) were focusing on support for writing major modes and didn=E2=80=99t give enough attention to the customization aspect, = especially for beginners. >> We just don=E2=80=99t want a central = tree-sitter-font-lock-feature-list that controls > the feature list of every major mode in a single place. > > What would you think of something like a `user` feature that could be = enabled > globally and users could add their mode-specific rules there? Eg. > > (defvar my-treesit-font-lock-rules > (treesit-font-lock-rules > :language 'go > :feature 'user > '((identifier)) > > :language 'typescript > :feature 'user > '((identifier)) > ;; ... > )) > > This wouldn't work very well in certain cases where ordering of the = rules > was important, however. I think that=E2=80=99s a good start. I like that it=E2=80=99s tied to = each language rather than a major mode, so it avoids problems with derived major modes. Indentation can also use some easy customization options. On a separate note, something like this might be better off in a ELPA package, such that it has more freedom to evolve and break things. Things that are added to Emacs core tend to fossilize, or at least become very hard to change. (To be precise, I mean the interface tend to be hard to change, implementation details can and do change all the time.) I=E2=80=99d say that order wouldn=E2=80=99t be a problem since I imagine = most of tht time, the user wants their fontification override all else. Yuan