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#60256: 29.0.60; Maybe improve tree sitter default treesit-language-at function Date: Sat, 24 Dec 2022 14:43:18 -0800 Message-ID: References: <87h6xnenhl.fsf@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) 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="39330"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 60256@debbugs.gnu.org, Wilhelm Hugo Kirschbaum To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Dec 24 23:44:40 2022 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 1p9DFw-000A1E-1z for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 24 Dec 2022 23:44:40 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9DFM-0005TM-Jk; Sat, 24 Dec 2022 17:44:04 -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 1p9DFL-0005T5-KT for bug-gnu-emacs@gnu.org; Sat, 24 Dec 2022 17:44:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9DFK-0003d5-1v for bug-gnu-emacs@gnu.org; Sat, 24 Dec 2022 17:44:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p9DFJ-0008BO-RP for bug-gnu-emacs@gnu.org; Sat, 24 Dec 2022 17:44:01 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: <87h6xnenhl.fsf@gmail.com> Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 24 Dec 2022 22:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60256 X-GNU-PR-Package: emacs Original-Received: via spool by 60256-submit@debbugs.gnu.org id=B60256.167192180931355 (code B ref 60256); Sat, 24 Dec 2022 22:44:01 +0000 Original-Received: (at 60256) by debbugs.gnu.org; 24 Dec 2022 22:43:29 +0000 Original-Received: from localhost ([127.0.0.1]:47271 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p9DEn-00089e-CI for submit@debbugs.gnu.org; Sat, 24 Dec 2022 17:43:29 -0500 Original-Received: from mail-pf1-f171.google.com ([209.85.210.171]:42835) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p9DEl-00089L-9H for 60256@debbugs.gnu.org; Sat, 24 Dec 2022 17:43:27 -0500 Original-Received: by mail-pf1-f171.google.com with SMTP id 65so5352654pfx.9 for <60256@debbugs.gnu.org>; Sat, 24 Dec 2022 14:43:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:from:to:cc:subject:date:message-id :reply-to; bh=4WZDx4WracP7yGdvWM5jdMaOClVxXIpuUcUTCCAXB64=; b=j+waXLQj6RN/ahum0BPwN1XWuMjlFdiKGPx2cd33ZwBcXBZbhfBuvzJdf6N4TbXgVQ T9NQRH7yaHAoenYsatCGsO04fx5qnP5RNtTPM0xghNtqk5DzoiX+l/DjCBPeqb5b3Vh4 Orm9yUykUg3vS5nHR8ekQGYA+GWnminEh37ns5RwQOQwknbMH8po/sW2VF/wCChX3O9c vKvlz79NZKMZ84OX6q87XXVu/ezD7R/8Im79/GDCyscgtCwuyHX2GiQddNO5hCd4g/eU uupEsRUj71Va/3FDigzbSFjzGVVbDLnGzwYrS40QxbtTCMLbu6OZhKizhMUeihL0WZsi yQPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=4WZDx4WracP7yGdvWM5jdMaOClVxXIpuUcUTCCAXB64=; b=YLfyEUR1OQBNIzHqFN08HYBu2aiR7wHf9K+MHc++pqkRFEMF+msWuIVG1Lj+Hp1XPc r8oxBmNJqlqam4tBA03SQig8NwITMg/rBi2Z6d9/QiiKqbZBHf4vBI+46oedzZBTxcLC l7Wk8vtHWvGv9mtCRHLHKjJbp7crlifWl5Rg0L6k4Vtu3CD8TAwfTgj0wX3oJBp8zXRk M0qDsCCYSQ2V/FVfCOCbB8c+vHhBs0p13htx9e4Ab8la9VSOXPnApuFdEr736lGsimHp 5eG09JiMsoDSDYcPuzWWpM9YhTzQa8ZbLTD2MaSH1llzYpW15Ki8VjWeTwL6kDAKiL+u 9SPw== X-Gm-Message-State: AFqh2krv/r5JsN6ZXhLM5c7qfmFy950bOZeVX6vR1lVH69ISRyurpUFa cpVOzyeF8kd5MwyPUoMYrhI= X-Google-Smtp-Source: AMrXdXum0VHFdENSidjCuOHHRZ1CRMFlnTJi3hOPrwF69vSym0AV7cLTP9Q88CHtGfLie0oRQozqxA== X-Received: by 2002:a62:1ec7:0:b0:575:d195:ddb6 with SMTP id e190-20020a621ec7000000b00575d195ddb6mr14755443pfe.25.1671921801467; Sat, 24 Dec 2022 14:43:21 -0800 (PST) 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 x124-20020a623182000000b005779110635asm4564932pfx.51.2022.12.24.14.43.20 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Dec 2022 14:43:21 -0800 (PST) X-Mailer: Apple Mail (2.3696.120.41.1.1) 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:251818 Archived-At: Eli Zaretskii writes: >> From: Wilhelm H Kirschbaum >> Date: Thu, 22 Dec 2022 12:30:09 +0200 >>=20 >>=20 >> We can detect the language from treesit-parser-included-ranges, so >> instead of taking the first parser from the list what about taking=20 >> the first parser within known ranges? > > Yuan, any comments? Yeah, sorry for the delay. I don=E2=80=99t think it=E2=80=99s worth it, = because (1) I expect major modes with multiple langauges to implement treesit-language-at-point-function which takes care of all the work, and (2) in the rare case where there are multiple languages and no treesit-language-at-point-function, using the first language whose range spans point (this patch) is not necessarily correct: the host language = (eg, HTML among HTML, CSS & JavaScript) always covers the whole buffer, only embedded languages has ranges. Yuan