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.devel Subject: Re: [PATCH] treesit.el: New function to describe font-lock rules Date: Fri, 6 Oct 2023 00:05:17 -0700 Message-ID: <43D13B5A-A267-4181-893E-506D955E973E@gmail.com> References: <46a990f4-0cc1-43cb-b017-38e205e05777@gmail.com> 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="19888"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel To: Huan Thieu Nguyen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Oct 06 09:06:25 2023 Return-path: Envelope-to: ged-emacs-devel@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 1qoeum-00052z-Tr for ged-emacs-devel@m.gmane-mx.org; Fri, 06 Oct 2023 09:06:24 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qoetz-00058i-97; Fri, 06 Oct 2023 03:05:35 -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 1qoetx-00058U-DE for emacs-devel@gnu.org; Fri, 06 Oct 2023 03:05:33 -0400 Original-Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qoetv-00059c-Qn for emacs-devel@gnu.org; Fri, 06 Oct 2023 03:05:33 -0400 Original-Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6910ea9cddbso1554804b3a.0 for ; Fri, 06 Oct 2023 00:05:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696575930; x=1697180730; darn=gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=WkRKSqVBiy8ffJNUXmp7zCzDEgtbOWUlKzbew+FQ8+E=; b=fOiacjSr7FJEB/0po6IBoPB4bGY4jOGNfELKe5Ri9rKfYEsGCoCtXOkl4rANtc8A1W Tz0l3sMldvezgSh5Syk++mQOFn5tY5DO0PbcvC5Sf4HhuUQhbsbgUex0N3i1Yo6YYwVW Q/0osqllyKbDk7JxH/Dh4cGPtJPYs2Dm7NzCdIlhpB7il25sdIBgfQhuxcLwqkGV38LO +wfzkqjruIZ1jArT3YEQ/pGl+2vCfes9yOQUWh6/BJa4M1Sig38BHnzxbcBxVpkw06C2 EzT2hb8G+6OKcoovEdXN50j15VYZuFgV4jqHHkJYYUaAecDzScJhYJz2tZ997NKf8VT5 YYSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696575930; x=1697180730; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WkRKSqVBiy8ffJNUXmp7zCzDEgtbOWUlKzbew+FQ8+E=; b=M4aRhAuv9KcqNHDjkKekdCTpHIN07cOOUzjCHst2l1zfsnKfeamMY/wbNLBbYnLJNX pJpDiLCNtJt+lkXnGcKUa5ZFLV9sgMWhEo/uUBraSLvquIteCN2wJ8enjU7sJwoIGcfL /zBu8nYpptEfvXSOe1w8ZlRusdBCVSnf6zrOU0Fmpw7pGEQbdvMLy2U7PAG0KLPVah4X MEZ1oiUokFjNKdZBJLYlHx4soKTMOGPIlgKJWkOAxV79GMyKDXx6S32gJJcUU90Yq03w 66byP5It1gVKb/WG1Im17GoKMfw3eaoAwncFKQo5yjQLGnGI29SsYFTw+6FN/gikSJ6F sO0A== X-Gm-Message-State: AOJu0YwvTpS+fnUxoVv9h+DRHzI8oRLThXJ1wezQuqeKZnuzFChdP/gL 3sLnlTZ8i3zZ8VoJj2Mub3E= X-Google-Smtp-Source: AGHT+IGPnMIsF4EoUxrW8nU2dkGvpWcDIHiqirQEX+qbQLBBiQUd0kHxpA42i4trrtRYd4eT2uI+RA== X-Received: by 2002:a05:6a00:1989:b0:68f:e121:b37c with SMTP id d9-20020a056a00198900b0068fe121b37cmr8568892pfl.4.1696575929793; Fri, 06 Oct 2023 00:05:29 -0700 (PDT) Original-Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id du12-20020a056a002b4c00b006934a1c69f8sm730104pfb.24.2023.10.06.00.05.28 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Oct 2023 00:05:29 -0700 (PDT) In-Reply-To: <46a990f4-0cc1-43cb-b017-38e205e05777@gmail.com> X-Mailer: Apple Mail (2.3731.700.6) Received-SPF: pass client-ip=2607:f8b0:4864:20::42d; envelope-from=casouri@gmail.com; helo=mail-pf1-x42d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:311320 Archived-At: Hi Huan, > On Oct 3, 2023, at 6:32 AM, Huan Thieu Nguyen = wrote: >=20 > Hello emacs maintainers, >=20 > I think most major modes don't need to use multiple tree-sitter = grammars, so I made a function called `treesit-font-lock-simple-rules' = which saves the user from typing `:language` for every query-spec. >=20 > I have not added an announcement in the news file yet. Sorry for the late response. I agree it=E2=80=99s somewhat tedious. I = didn=E2=80=99t came up with a clean solution for it at the time and left = it be. Instead of finding :feature keywords and appending :language keywords = after them, maybe we could introduce a secret keyword (say, = :default-language or :global-language) to treesit-font-lock-rules, and = make treesit-font-lock-simple-rules use that. We could also just add the :default-language or :global-language keyword = to treesit-font-lock-rules. If we do that, we can also add = :default-override, too. But adding global keywords doesn=E2=80=99t look = super clean to me (and it might be a bit confusing), that=E2=80=99s why = I didn=E2=80=99t implement it in the first place. Yuan=