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: Extending define-derived-mode Date: Thu, 8 Jun 2023 00:25:53 -0700 Message-ID: <9DAD00FE-8147-471E-95B1-5AEF0865D2C3@gmail.com> References: <20F07C52-6B39-4B24-8433-82E2226EADA6@gmail.com> <83zg5mf62s.fsf@gnu.org> <835y87elec.fsf@gnu.org> <83ilc6axl9.fsf@gnu.org> <85BA8FC1-148C-438B-877A-A06CDCCDE1BF@gmail.com> <83sfb6400h.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.600.7\)) 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="26025"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Stefan Monnier , emacs-devel , Mickey Petersen , Theodor Thornhill , dgutov@yandex.ru To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jun 08 09:27:10 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 1q7A33-0006aM-QC for ged-emacs-devel@m.gmane-mx.org; Thu, 08 Jun 2023 09:27:09 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7A2C-0005lm-KL; Thu, 08 Jun 2023 03:26:16 -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 1q7A27-0005kj-IA for emacs-devel@gnu.org; Thu, 08 Jun 2023 03:26:11 -0400 Original-Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q7A23-0007Bx-R6; Thu, 08 Jun 2023 03:26:10 -0400 Original-Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1b24eba185cso1069435ad.2; Thu, 08 Jun 2023 00:26:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686209165; x=1688801165; 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=odG0wh4cJkeij5PGvadWRH30KOzbYcXHYy1g/vhwctc=; b=JCVBaIuGPrSL8hbsQJQvuiJyrB4tahjWi1DCzcf4oQzahOCYDLZ87L1D1JP8am4blA UIRzdNbDTsSRKyw2YIHFLPue67IRnKRpShlKwx+Z1pIe9y7xa2ui5jKboyzd6PX1DZle HEBxYqpKJtlUc8StNtyHMKmdtkL6cdoR4DPur6UXmplWCgVR4c4tCxWfFFqctrOEaUfr zMnSZGidJPc/Z77J6BUn8KqPF3GrHfgGJf4CNmwwpRPVMf5vXR0EXXG0/AObYOhelchn 15Q4/qIF0kG6B+QnVTBwTdRU85RvRN+8fw8ie8F5gfaSZlOOGmRBBmyoF6FbT4TOAlTC KpMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686209165; x=1688801165; 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=odG0wh4cJkeij5PGvadWRH30KOzbYcXHYy1g/vhwctc=; b=CCH3G1tgMQxZg0UwyUwfdswX7vHfgMMoRQiNsyc6Uhj79smLvHPNkdC9aSRUlbXwOL uF6orSudSQY0HR6MlEN0i5NL9IgOHGULnMdDHVmxkk91NcqWCDAltODcb0TnhkoucijS QNAUExxz7o4lqX0HZ4O5vvHHRvHYosC4MnyS7brap0SnwOg2TU2MeV11LhFOQM1+YTta dmoHrupN3F9BET+HEVxkq+haLv4qyVmtnWoUOMKuazZ89dwPvpTMcCvYTe7HNm4egscq iPZr0t2D0NT4kbsXynPidMMgvFa4lW/N3Hc3lARJEWb7cllvzhoohH2dQjPn3kvVQdPD qn+A== X-Gm-Message-State: AC+VfDyK9xAwDiIuHPXvJBrKF9i/EOybw9kr+ZXUwGViyGnjfXZf4o3W jb7B3rR04TMv19W1ptPA4hHVbSYdFLs= X-Google-Smtp-Source: ACHHUZ6kfZVymRQRFeem+1YSFL1FK0Bq5iLaBs9i3/g2ekpj2RHbfJMhhRctNzEzNoCq+lFo5luRGQ== X-Received: by 2002:a17:903:190:b0:1b3:696f:b77 with SMTP id z16-20020a170903019000b001b3696f0b77mr597743plg.48.1686209165554; Thu, 08 Jun 2023 00:26:05 -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 o8-20020a170902778800b001ac2c3e436asm715889pll.186.2023.06.08.00.26.04 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Jun 2023 00:26:05 -0700 (PDT) In-Reply-To: <83sfb6400h.fsf@gnu.org> X-Mailer: Apple Mail (2.3731.600.7) Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=casouri@gmail.com; helo=mail-pl1-x62a.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.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, FREEMAIL_REPLY=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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:306697 Archived-At: > On Jun 5, 2023, at 4:33 AM, Eli Zaretskii wrote: >=20 >> From: Yuan Fu >> Date: Mon, 5 Jun 2023 00:31:02 -0700 >> Cc: Stefan Monnier , >> emacs-devel , >> Mickey Petersen , >> Theodor Thornhill , >> dgutov@yandex.ru >>=20 >>> For users to be able to share stuff like electric-quote-local-mode >>> we'd need to rewrite those supporting modes to allow that. When one >>> of the two modes uses regexps and syntax tables, whereas the other >>> uses treesit-based parsers, this is not a trivial task. I invite = you >>> to audit the various electric modes we have and see how many of them >>> can be shared with minimum effort between non-TS and TS modes. >>=20 >> I=E2=80=99m talking about sharing the sharable config. Electric modes = already work the same in ts and non-ts modes: electric-pair-mode and = electric-quote-mode inserts matching pairs and quotes and aren=E2=80=99t = affected by tree-sitter, electric-indent-mode uses the standard = indent-line-function which both ts and non-ts modes confront to. Is = there any other electric modes? >=20 > For one prominent example, see the node "Electric Keys" in the CC Mode > manual, and the minor modes described in "Minor Modes" there. Ok, but they are CC mode=E2=80=99s features, not Emacs-wide features = like electric-quote/pair/indent-mode. >=20 >> Also, ts modes generally have the same syntax table as non-ts modes. = So if some package uses the syntax table they are largely not affected = either. >=20 > But it makes little sense to me to have part of a mode use our syntax > tables, and another part use the results of parsing the code by a > parser library. I can guarantee inconsistencies. Not really used by the mode itself, but some generic third-party = package. Having correct information in the syntax table is better than = not. Also some ts modes enhances the syntax table information, making it = more accurate, by adding appropriate syntax-table text property on some = chars, like the angle brackets in C++ and Rust. Yuan=