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: Average-user-facing interface for tree-sitter Date: Tue, 18 Oct 2022 15:06:12 -0700 Message-ID: References: <3A7E7CD1-74A7-4352-9DFE-FC982EAA398E@gmail.com> <87ilko9r9e.fsf@gnus.org> <9794E2EF-4DB5-4A04-90F0-3EB51E6BE008@gmail.com> <87977C2D-844B-4F4E-BEA4-8BCBFC8AE354@gmail.com> <6A0F847F-910D-449B-B461-466493CC9847@gmail.com> <87sfjmg69q.fsf@gnus.org> <21B2ADDF-70BC-46D4-98D6-41C5D0EF7D40@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="7414"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Lars Ingebrigtsen , emacs-devel To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Oct 19 00:07:28 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 1okukC-0001hK-Qa for ged-emacs-devel@m.gmane-mx.org; Wed, 19 Oct 2022 00:07:28 +0200 Original-Received: from localhost ([::1]:44456 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1okukB-0002yP-BA for ged-emacs-devel@m.gmane-mx.org; Tue, 18 Oct 2022 18:07:27 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52862) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okuj3-0002Fi-PC for emacs-devel@gnu.org; Tue, 18 Oct 2022 18:06:18 -0400 Original-Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]:53839) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1okuj2-0004o3-5R for emacs-devel@gnu.org; Tue, 18 Oct 2022 18:06:17 -0400 Original-Received: by mail-pj1-x102d.google.com with SMTP id fw14so15313866pjb.3 for ; Tue, 18 Oct 2022 15:06:15 -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=RcT1+FUmDqwXetzSmhBJUuPwBXUGj95urCNBDqJwC38=; b=KPLCCTqesUKC+k+gvzopfVAVbWOPEPsm79ytYn8UmsbFN/pMA27Oqlr4tZN4QKrP6R LN9eDAhEZlKiReIbwkLZloUBeM55N3dbDqmOD+YTn6/KgEq2Av3xf3tXTkWZ1RNLOYZ8 r6nPaywwrxq87qM0u2OTY48W4ZGRLfpVFiMicNqC7sdy0dFpXUNHEpQ31qV6AElqkGo6 krWg8qEmBMW+hHmnDLPGYRg9jlvgmlb3QMJLlFtm71HMybS52CeLTZs8m5fzLO5SpqiG GW7tepaoYPWOeXVGd5cHYp4lLFAgv3QRVvYa3LTrZy+hGa9H9sRuZwBxl+IUVDqQeUHQ 7s+A== 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=RcT1+FUmDqwXetzSmhBJUuPwBXUGj95urCNBDqJwC38=; b=C7tCESFGr6y3LnG8RzOAlcoGESUD8JxwCD16X7bKfUfDfZG+o1ZHZ/Gwqs/LjClxXj Ah6JPHglYkgoWN/DnAo8O9aa5temOeRQVgzhDHDxzjMQqtX+u2snxMMnTQfVd6P5H4lz SLGYP9ovDal36zQotXH+/XnZL6cQ6YUBplNBZgOAVkrII15tdaY0Yv3GiO0ybfcvHB54 6IW9wdDlyhjrp8lEBvxxlYFUdchJMHwC4h5tnWgOerP8puPkduXAWOO124pxo8lkOTSZ nMQBVTdJpZvz66jEIxvxkP41hFlhQKMtdcYMuLqL5DO+2iVz1D4PMMJ8xtnfkmP5xer0 u1uQ== X-Gm-Message-State: ACrzQf0hnk+0uKjOvqnN3rcuYUeqvuKuQEAF2QZZxYfAHSyeAWazJO3r 8SUsOt6uGN7SbjoOYdLhmsWxp06WQkg= X-Google-Smtp-Source: AMsMyM6gDHsiUORqizFedJ1wXR3BL5jE7/xBjNHlurGQSW8QB3TNJAISzle+JH0rVWY9lk7BxU47ng== X-Received: by 2002:a17:902:ec91:b0:182:8eca:ade2 with SMTP id x17-20020a170902ec9100b001828ecaade2mr5077012plg.12.1666130774467; Tue, 18 Oct 2022 15:06:14 -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 f11-20020a65590b000000b0042c0ffa0e62sm8559522pgu.47.2022.10.18.15.06.13 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Oct 2022 15:06:13 -0700 (PDT) In-Reply-To: X-Mailer: Apple Mail (2.3696.120.41.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=casouri@gmail.com; helo=mail-pj1-x102d.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:298087 Archived-At: > On Oct 18, 2022, at 2:48 PM, Stefan Monnier = wrote: >=20 >> For separated major modes, they need to do a bit of a dance. >=20 > I don't think we should even try and document what they should do: > they're evil and we should spend our efforts merging them into one = instead. >=20 >> Besides switching to the new major mode, they need to add (mode >> . new-mode) to major-mode-remap-alist if global-treesit-mode is on = (so >> next time we go straight to new-mode as long as global-treesit-mode = is >> on). They also need to add (mode . new-mode) to >> treesit-remapped-major-mode-alist so global-treesit-mode can remove >> these entries when it turns off. >=20 > Too much magic, IMO. Let each case handle it manually, since I = suspect > that every case will be different and the best thing to do will vary = (it > depends on whether the two modes are still actively maintained, = whether > by the same authors or not, the relative age and popularity of the > respective modes, =E2=80=A6) So we don=E2=80=99t do anything in global-treesit-mode? Ie, (define-globalized-minor-mode global-treesit-mode treesit-mode global-treesit-mode--turn-on :version "29.1" :group 'treesit :predicate t (when (not global-treesit-mode) (dolist (map treesit-remapped-major-mode-alist) (setq major-mode-remap-alist (remove map major-mode-remap-alist))))) to (define-globalized-minor-mode global-treesit-mode treesit-mode global-treesit-mode--turn-on :version "29.1" :group 'treesit :predicate t ) And remove treesit-remapped-major-mode-alist? Yuan