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: Wed, 31 May 2023 13:35:05 -0700 Message-ID: References: <20F07C52-6B39-4B24-8433-82E2226EADA6@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.500.231\)) 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="21538"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel , Mickey Petersen , Dmitry Gutov To: Theodor Thornhill Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed May 31 22:36:28 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 1q4SYW-0005Ln-M3 for ged-emacs-devel@m.gmane-mx.org; Wed, 31 May 2023 22:36:28 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q4SXW-0006Jo-94; Wed, 31 May 2023 16:35:26 -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 1q4SXS-0006GE-7b for emacs-devel@gnu.org; Wed, 31 May 2023 16:35:22 -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 1q4SXQ-0002vO-Ds for emacs-devel@gnu.org; Wed, 31 May 2023 16:35:21 -0400 Original-Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1b04706c85fso1056965ad.0 for ; Wed, 31 May 2023 13:35:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685565318; x=1688157318; 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=68AsKtrl5pAzT/g8rcbGLrFhU8DkJFbBH31GlCJLxe4=; b=MHzZY5tg+pcIMs3R/zb9Xv9YkaExkR5Gv5Iy21p5JSZA0yQH2lRK2zLKg5g7hO80CS 05I2RadU93Bm6FUlM3vDb8djvUQKKnni2s5T+DhyzKhe9CmLcx5+yftDVKHl6m/QkUvY OEKhtOkDBWM7y/adtp5rfhBo2vPu9MuEEP5vcY6wGlAIsordHuHM+z5BXQHpKOrKbf+8 bYUsSy69VpvzdYO2Mz8RISm4cMSZCJLERXfp0rys586MzF/GUBmPPEHpx3Ep+FrjilyK AdeNycZzPPe21CXBGe0usYh8aKEPWhEPmolfVN6RwxRHL3YilYL0wU+wqujKONWbihAV rkaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685565318; x=1688157318; 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=68AsKtrl5pAzT/g8rcbGLrFhU8DkJFbBH31GlCJLxe4=; b=P9NGuDH+T6Dou/qNvDk5LZob201ESWGcolspVVKCG3mcYSlc4iskQvcn63Ca39jxDG 9uUXEaobF5gEmiKoB8iw0zVDEpGaHosbxRNVbluaapFF8hPtvV2vdAvgSaJdxrVI1aji VCdwuTzYwTI3t6Jjt/QjyXAFtt1Rc8DUun7+gMR9IM0tpCkOJ/uxkhGL+rsdi9eIEEZe uhCtmgJ4c+pH9OM62YTrJpbhXGatd9r8J+CnklGzH5QtJ7LDK+YPeFSt0bvjuL+rp0+q lcEQr13dxs9lWKaN38+9gQyecJfzQeSlYYrepmXNkEspnr43NGKkfGjlOuTrxgj7i8wO Romw== X-Gm-Message-State: AC+VfDxw+bwZ2yfDyXlOcQjVz8L0L6kfnzgHzeZ7UXm0YhN2YanMbKBh uXnP4B5jvmtsntZMl6dSLjo= X-Google-Smtp-Source: ACHHUZ7jMVyNY5FKPYL7bIevFAbor651iYEVaB8xj8MBJy1seVnblOFMBjtIECe99vywyglf4tKieg== X-Received: by 2002:a17:902:d4cc:b0:1b1:1168:6571 with SMTP id o12-20020a170902d4cc00b001b111686571mr4377629plg.36.1685565318398; Wed, 31 May 2023 13:35:18 -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 l12-20020a17090270cc00b001a1a82fc6d3sm1781067plt.268.2023.05.31.13.35.17 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 May 2023 13:35:17 -0700 (PDT) In-Reply-To: X-Mailer: Apple Mail (2.3731.500.231) 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: -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, T_SCC_BODY_TEXT_LINE=-0.01 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:306463 Archived-At: > On May 29, 2023, at 10:51 PM, Theodor Thornhill = wrote: >=20 >=20 >=20 > On 30 May 2023 07:16:49 CEST, Yuan Fu wrote: >> When we were adding tree-sitter modes a couple of month ago, it was >> clear that the current major mode model needs some upgrade, I=E2=80=99d= like >> to discuss the things we need and how can we address them. >=20 > Thanks for bringing this up! >=20 > I'll quickly just add one more thing, and respond more thoroughly in a = different mail: >=20 >=20 > Maybe we can consider another abstraction to cover the following: >=20 > - configure what set of modes to use for a given language > - set choice of diagnostic tool (flymake/flycheck etc) > - set LSP client implementation with config to use > - project based configs > - separate mode name and implementation >=20 > I posted some time ago a simple idea covering this, and maybe the time = is now to revisit this idea? People seem to like doom Emacs/spacemacs = etc, so their idea of "layers" may be a nice route to consider. >=20 > We can supply some DSL with preconfigured settings, and add extensible = functionalities. >=20 > Maybe something like: >=20 > (define-layer 'javascript-mode > :mode 'treesit > :enabled-in '(".js", ".mjs") > :diagnostic-backend 'flymake > :lsp-client 'lsp-mode ;; default is 'eglot > :project '(:root-function #'some-rootfinder-fn) > :other-stuff '(eslint json-something nvm)) >=20 > This may seem only tangentially related to your email, but I believe = it is, in that mode inheritance touches the "the first language mode = implementation owns the namespace"-problem. Yeah this look interesting. =46rom your example it looks more like a = configuration oriented, like a more integrated use-package. I feel like = we should solve the "the first language mode implementation owns the = namespace=E2=80=9D-problem in a more direct and standalone way. Yuan=