From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Theodor Thornhill Newsgroups: gmane.emacs.devel Subject: Re: Extending define-derived-mode Date: Thu, 01 Jun 2023 07:43:05 +0200 Message-ID: <87leh3ivpy.fsf@thornhill.no> References: <20F07C52-6B39-4B24-8433-82E2226EADA6@gmail.com> Mime-Version: 1.0 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="17592"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel , Mickey Petersen , Dmitry Gutov To: Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jun 01 07:43:39 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 1q4b62-0004Kr-At for ged-emacs-devel@m.gmane-mx.org; Thu, 01 Jun 2023 07:43:38 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q4b5k-0006bL-W2; Thu, 01 Jun 2023 01:43:21 -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 1q4b5d-0006ae-2b for emacs-devel@gnu.org; Thu, 01 Jun 2023 01:43:14 -0400 Original-Received: from out-38.mta0.migadu.com ([2001:41d0:1004:224b::26]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q4b5Z-00071m-DU for emacs-devel@gnu.org; Thu, 01 Jun 2023 01:43:11 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1685598186; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=35fQ3D5MfTwnQ1ivgHGuDJ6VrzYYZkm0XGLjzMWE+to=; b=S5e1jkQ6NbVqs3LvC75C/yez29iOiMVtUIgdnoq15CBG/vDSu4OvMKikz/tbtm/GOb2ycv SaeF5C1X9QewVwMPoVNEo91KqaQrqp3T7llittHwGl3UI3BobPkwDS5h428Ws73lnNJvmZ XR0xeadv1lizBGHw0RQImFlGPdp/16TGHZEtQitjkTYRe4lOyKaLNmYcQ7aZUXEdG8mfp0 VcXkNLn2Lg2qI+APLvlOun+uPAr3BbJ2GO2jCMCnTUZz5cg+SS8WlzfpMQ61ngv/qZ1g38 5Qk8/kyRLFy86N3s14FbdogoFHDJXNGVfF2Qs9/pS9/bu3M4IxzE4YMSbYPf7w== In-Reply-To: X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=2001:41d0:1004:224b::26; envelope-from=theo@thornhill.no; helo=out-38.mta0.migadu.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, 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:306476 Archived-At: Yuan Fu writes: >> On May 29, 2023, at 10:51 PM, Theodor Thornhill wrot= e: >>=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 d= ifferent 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 i= s now to revisit this idea? People seem to like doom Emacs/spacemacs etc, s= o their idea of "layers" may be a nice route to consider. >>=20 >> We can supply some DSL with preconfigured settings, and add extensible f= unctionalities. >>=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 implement= ation owns the namespace"-problem. > > Yeah this look interesting. From your example it looks more like a config= uration 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 Yeah, I agree. This example would piggyback on such a solution.=20