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: Call for volunteers: add tree-sitter support to major modes Date: Sun, 9 Oct 2022 23:46:27 -0700 Message-ID: <5244C2EB-A319-4CDF-9F60-422798E29F95@gmail.com> References: <83czb1jrm3.fsf@gnu.org> <84436B1D-3359-487F-B997-A7F56FDEA636@thornhill.no> <83bkqljih5.fsf@gnu.org> <87fsfx6ufb.fsf@thornhill.no> <8335bxjdpf.fsf@gnu.org> <1D07A0F1-A269-410A-9D3C-8A53113FFE2F@thornhill.no> <83sfjxhuvc.fsf@gnu.org> <87bkqk7qb0.fsf@thornhill.no> <8735bw7kwm.fsf@thornhill.no> <158F25C9-A539-4515-8D49-50A7E6252960@gmail.com> <9941E2A6-AB31-49FE-A6BA-9BE61BA6ED13@gmail.com> <83fsfwi44y.fsf@gnu.org> 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="24806"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Theodor Thornhill , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Oct 10 08:50:32 2022 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 1ohmcR-0006G0-TU for ged-emacs-devel@m.gmane-mx.org; Mon, 10 Oct 2022 08:50:31 +0200 Original-Received: from localhost ([::1]:41212 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ohmcP-0003D1-0m for ged-emacs-devel@m.gmane-mx.org; Mon, 10 Oct 2022 02:50:30 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43202) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ohmYc-00011C-4V for emacs-devel@gnu.org; Mon, 10 Oct 2022 02:46:34 -0400 Original-Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]:41824) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ohmYa-0002hy-Dv; Mon, 10 Oct 2022 02:46:33 -0400 Original-Received: by mail-pf1-x42d.google.com with SMTP id g28so9986738pfk.8; Sun, 09 Oct 2022 23:46:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=6wql2tyt05jR9QzXwim857kIzoOVW+g45Qa9gVi2cn0=; b=E6L2mO3jRe+evCGMCYt1jtoS/ZFHJ0j2JCRMc54uNSZnzIWcLXy3HF0g+6TiRyMvjN VnylEwHeDrwikWgqUV7S20cQwK9giWslk7f3MDQItrE3atwEtRl2d9REH6P6KPIvToE5 y5P8DAzWF6eK2sw+idfNo/UTwOt6SlXNz0WRARYXbDAonAA5aWO2bkrdHL2DoJErU1TL ezLo1MpOv1HfOGTzoTe28PmIcAwZsTni7IH8/t0XZra/qczLqcOW6lQtVTydLGzBwNum jt83hzY2lrzZJmNwJUU4feX337BBqyqfBzFcZquTLEiCeWbTZuce2IbvU52eoegGMyfo bvSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=6wql2tyt05jR9QzXwim857kIzoOVW+g45Qa9gVi2cn0=; b=IAkthrAN/Y1T0DEihu71u8V6yCFIKMZctj3o/ceKPxjrwzKymjqMrfJL9tNYh+otM/ M8ExnpK2jINu5TO7LMU9/odrXmg1hb57RoGV5vKc4EB6em/SIe06SLt72GR/XfDoLmYv GVAA13tERvJBiB/6pCikrZCeR9b5DFg2aMk3K3/w1Dxbpa4MyewH+uxHHOIzmh1syOu2 nML7Uh6lvP58YAvrQ1TewbcAsX3Kny0lJKGoIlmjpyQjHxnFOrcYoTqZevwLjhQW5OL0 z3YjqjGamdK7EbllvYcLoQ4WUhEdLFMyw9JXDMsSwbvXyNfQpOYAeuQ38qSjZoYmLf/W bwfg== X-Gm-Message-State: ACrzQf1OUQjrcvfqkYPj47Uopw6ACwuxciTuUz/ag7Qg3uowxq2zwJmA GW1n4t8sUkDCZsoyMPpHPc0ov4MtzIg= X-Google-Smtp-Source: AMsMyM6XFlg3F/ijVfZDQ1bbwHbvsmm4qh8wt0PH4GQt4iGFG8H0ZveGZ1izkLki7qRud/J+xUtOHg== X-Received: by 2002:a05:6a00:b4c:b0:563:3344:52af with SMTP id p12-20020a056a000b4c00b00563334452afmr6689951pfo.22.1665384389276; Sun, 09 Oct 2022 23:46: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 g11-20020a170902d1cb00b001769206a766sm5727207plb.307.2022.10.09.23.46.28 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 09 Oct 2022 23:46:28 -0700 (PDT) In-Reply-To: <83fsfwi44y.fsf@gnu.org> X-Mailer: Apple Mail (2.3696.120.41.1.1) 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" Xref: news.gmane.io gmane.emacs.devel:297318 Archived-At: > On Oct 9, 2022, at 11:28 PM, Eli Zaretskii wrote: >=20 >> From: Yuan Fu >> Date: Sun, 9 Oct 2022 21:05:09 -0700 >> Cc: Eli Zaretskii , >> emacs-devel@gnu.org >>=20 >>> + >>> +(defun js--treesit-enable () >>> + (unless (and (treesit-can-enable-p) >>> + (treesit-language-available-p 'javascript)) >>> + (error "Tree sitter isn't available")) >>>=20 >>> I don't think we should error here, I'd displaying a message = instead. >>=20 >> Actually we should also fall back to non-tree-sitter if the = conditions aren=E2=80=99t met. >=20 > Automatically and silently? I don't think so. The user should know > the knob they pressed didn't work. Not silently, print a message, raise a user-error at the end, but = don=E2=80=99t fail completely and leave the user in a broken mode. I = suggest: (define-derived-mode mode (if (and use-tree-sitter tree-sitter-works) init-tree-sitter init-non-tree-sitter) (if (and use-tree-sitter (not tree-sitter-works)) ;; Or =E2=80=98message=E2=80=99. (user-error "Tree-sitter can=E2=80=99t be enabled"))) If we think this is good, I=E2=80=99ll add it to the starter guide. Yuan=