From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Bozhidar Batsov" Newsgroups: gmane.emacs.devel Subject: Re: Brand new clojure support in Emacs ;-) Date: Sun, 03 Sep 2023 17:01:33 +0200 Message-ID: <64500180-b308-4229-b248-102c688e09dc@app.fastmail.com> References: <87il9kksqz.fsf@dfreeman.email> <87a5uw9ivs.fsf@posteo.net> <87ttt42gna.fsf@dfreeman.email> <87wmy080kn.fsf@posteo.net> <83v8djcydl.fsf@gnu.org> <87350ndquw.fsf@dfreeman.email> <83350ncbns.fsf@gnu.org> <87cyzrjbd8.fsf@dfreeman.email> <83zg2vav46.fsf@gnu.org> <87o7j99304.fsf@dfreeman.email> <87zg2hsyrd.fsf@dfreeman.email> <87h6ontwfv.fsf@posteo.net> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=5a738e83d1be4fcb9e5d4b1939f36dec Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8099"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Cyrus-JMAP/3.9.0-alpha0-701-g9b2f44d3ee-fm-20230823.001-g9b2f44d3 Cc: "Richard Stallman" , "Danny Freeman" , "Eli Zaretskii" , "Emacs Devel" , "Manuel Uberti" To: =?UTF-8?Q?Jo=C3=A3o_T=C3=A1vora?= , "Philip Kaludercic" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Sep 03 17:02:41 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 1qcoca-0001sT-NH for ged-emacs-devel@m.gmane-mx.org; Sun, 03 Sep 2023 17:02:41 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qcoc4-0001YL-EX; Sun, 03 Sep 2023 11:02:08 -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 1qcobv-0001Xt-54 for emacs-devel@gnu.org; Sun, 03 Sep 2023 11:02:04 -0400 Original-Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qcobs-0000kP-1a; Sun, 03 Sep 2023 11:01:58 -0400 Original-Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id AB6B95C00B5; Sun, 3 Sep 2023 11:01:54 -0400 (EDT) Original-Received: from imap43 ([10.202.2.93]) by compute1.internal (MEProxy); Sun, 03 Sep 2023 11:01:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=batsov.dev; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1693753314; x=1693839714; bh=eZ h8MzI+YikhV4adzbzZ4zBgJW9n2rsLkA1frUqBC1Y=; b=HYkpqY8s4W4Kaz56LV q3oJpjunPeBurA8WUM213A8/LgD7C+5Se4wW+k1mOKVK1cCsutx56zajrkaSBfcm Sred1/hnLHdIbI1xBZLw5uEmYSSeO1ZZ2DH8iIJXTE1QdM70nM73uyuL1Lm3rGWt xxxy+N3TFfjts/jcNc3OIUDizEuAHPNnrGjfvjr8xweT6Q+9/P1/NFNoO8xzi+CX hi4HRuPuBdiqfda4KZE5PnEu283zLRDV9QBDy0PjnQhp5dAWhJfNtHCjytyBaEkw YCPQXX8a6ZS3hlTJZV3ArQAEn5sMSKT6vsyF8TqZuCrk5z+CMVWYA8adYK1YopPu 3TzA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1693753314; x=1693839714; bh=eZh8MzI+YikhV 4adzbzZ4zBgJW9n2rsLkA1frUqBC1Y=; b=OKffJhe8XrM4zVziAb13sl0D0CtT3 kcAAvX4mYbo3lQ8Tce7gBD26SBvJbTZz8ZqBTXRKKqrU0X4QvQnEXNQHST3daHH+ wCcrFLRDpspOB41UVJGEWJAnRpoyHBfJ2CbmSyKz4OdTcmTyUsnz8q1rjrzB8qSf GsAsjikIpZ76h2FjYT76HpGmwPpVKIbGkKOnIZzT+sMFcg8tnb5QX7w2OPvblCTK 8EXA7NGJeHGdlzlT4gx/E4+A/0x/v6D9QvwajwcsxrS1LZQzvL2jxMe/Hj7no6vX gY67Q0rqaq/iS6pCdQGYUoy3wJ1IG9WB/04AJxGmy1V4eVvkLE7X3bkhw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudegiedgkeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtsegrtderreerreejnecuhfhrohhmpedfueho iihhihgurghruceurghtshhovhdfuceosghoiihhihgurghrsegsrghtshhovhdruggvvh eqnecuggftrfgrthhtvghrnhephffhgfdujedvffejvefhtdehfeelleehuddvffetheei vefgieeijeevhfeiteefnecuffhomhgrihhnpeihohhuthhusggvrdgtohhmpdgrrhgthh hlihhnuhigrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghi lhhfrhhomhepsghoiihhihgurghrsegsrghtshhovhdruggvvh X-ME-Proxy: Feedback-ID: i025946a9:Fastmail Original-Received: by mailuser.nyi.internal (Postfix, from userid 501) id BFE772D4008F; Sun, 3 Sep 2023 11:01:53 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface In-Reply-To: Received-SPF: pass client-ip=66.111.4.26; envelope-from=bozhidar@batsov.dev; helo=out2-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:309980 Archived-At: --5a738e83d1be4fcb9e5d4b1939f36dec Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable > No idea if this works with the CIDER or SLIME backends for clojure. > Don't ask me to test any more cause I've just uninstalled it all > but any clojurians rading can have a go. SLIME + swank-clojure has been dead for about 10 years now. Part of the = reason we abandoned it and moved to nREPL + CIDER (or alternatively inf-= clojure) is that Clojure is a Lisp, but it's not Common Lisp (e.g. CL pa= ckages are definitely not the same thing as Clojure namespaces). Trying = to change Common Lisp tooling to fit Clojure was an exercise in frustrat= ion. Not to mention that many Clojure devs didn't really want to learn C= ommon Lisp as well, just to contribute to something like SLIME/swank-clo= jure.=20 It's funny that what you propose is more or less how things started 15 y= ears ago. Originally clojure-mode was just a very thin layer on top of l= isp-mode and we had tweaked slightly inferior-lisp-mode to be used with = Clojure. Similarly with SLIME + swank-clojure. Gradually clojure-mode be= came its own thing and CIDER and inf-clojure were created from scratch t= o provide tooling that was tailored specifically to Clojure. I even have= a very old talk on the topic, in case someone's interested in learning = more https://www.youtube.com/watch?v=3D4X-1fJm25Ww On Tue, Aug 29, 2023, at 11:09 PM, Jo=C3=A3o T=C3=A1vora wrote: > On Fri, Aug 25, 2023 at 8:26=E2=80=AFAM Philip Kaludercic wrote: > > > > Richard Stallman writes: > > > > > [[[ To any NSA and FBI agents reading my email: please consider = ]]] > > > [[[ whether defending the US Constitution against all enemies, = ]]] > > > [[[ foreign or domestic, requires you to follow Snowden's example.= ]]] > > > > > > It appears that there is no clojure-mode command in core Emacs. > > > There is a Clojure mode package, but it is in NonGNU ELPA. > > > > > > I think that language is important enough that, notwithstanding not > > > really being similar to Lisp, we ought to have a major mode to sup= port it. > > > Would someone please work on that? > > > > I had brought this up in the recent clojure-ts-mode thread, that I > > assume you are referring to. Sadly, I have no experience with the > > language, but one idea might be to extend lisp-data-mode by whatever= the >=20 > I don't know if this counts as "work on that" but here's two interesti= ng lines > Elisp: >=20 > (define-derived-mode clojure-mode lisp-data-mode "Clojure" > "Barebones Clojure") > (add-to-list 'auto-mode-alist '("\\.clj" . clojure-mode)) >=20 > Since it is a lisp dialect many things works here, like indentation, > symbol recognition, parenthesis balancing, C-M navigation, and thing-a= t-point. >=20 > And then there's LSP, right? >=20 > So I installed clojure-lsp from here: > https://aur.archlinux.org/packages/clojure-lsp-bin >=20 > I created a hello world project with the "lein" tool, git init, found = the > src/helloworld/core.clj inside it, pressed M-x eglot and suddenly I had > at-point-documentation, diagnostics, lots of refactorings, completion,= etc. >=20 > The thing that's a bit minimal is the syntax highlighting, but it's > not that bad either IMHO. Eglot doesn't yet support LSP-mandated syntax > highlighting. I have no idea what it takes to add TreeSitter support > to such a bare-bones mode (but shouldn't it be really easy like mapping > syntactic symbols to faces?) >=20 > No idea if this works with the CIDER or SLIME backends for clojure. > Don't ask me to test any more cause I've just uninstalled it all > but any clojurians rading can have a go. >=20 > Jo=C3=A3o >=20 >=20 > *Attachments:* > =E2=80=A2 clojure-mode-and-eglot.png --5a738e83d1be4fcb9e5d4b1939f36dec Content-Type: text/html;charset=utf-8 Content-Transfer-Encoding: quoted-printable
No idea if this works with the CIDER or = SLIME backends for clojure.
Don't ask me to test any more = cause I've just uninstalled it all
but any clojurians radi= ng can have a go.

SLIME + swan= k-clojure has been dead for about 10 years now. Part of the reason we ab= andoned it and moved to nREPL + CIDER (or alternatively inf-clojure) is = that Clojure is a Lisp, but it's not Common Lisp (e.g. CL packages are d= efinitely not the same thing as Clojure namespaces). Trying to change Co= mmon Lisp tooling to fit Clojure was an exercise in frustration. Not to = mention that many Clojure devs didn't really want to learn Common Lisp a= s well, just to contribute to something like SLIME/swank-clojure.

It's funny that what you propose is more or less= how things started 15 years ago. Originally clojure-mode was just a ver= y thin layer on top of lisp-mode and we had tweaked slightly inferior-li= sp-mode to be used with Clojure. Similarly with SLIME + swank-clojure. G= radually clojure-mode became its own thing and CIDER and inf-clojure wer= e created from scratch to provide tooling that was tailored specifically= to Clojure. I even have a very old talk on the topic, in case someone's= interested in learning more https://www.youtube.com/watch?v=3D4X-1fJm25Ww

On Tue, Aug 29, 2023, at 11:09 PM, Jo=C3=A3o T=C3=A1vora= wrote:
On = Fri, Aug 25, 2023 at 8:26=E2=80=AFAM Philip Kaludercic <philipk@posteo.net> wrote:
>
> Richard Stallman <rms@gnu.org> writes:
>
> &= gt; [[[ To any NSA and FBI agents reading my email: please consider = ;   ]]]
> > [[[ whether defending the US C= onstitution against all enemies,     ]]]
> > [[[ foreign or domestic, requires you to follow Snowden's e= xample. ]]]
> >
> > It appears t= hat there is no clojure-mode command in core Emacs.
> &= gt; There is a Clojure mode package, but it is in NonGNU ELPA.
=
> >
> > I think that language is importan= t enough that, notwithstanding not
> > really being = similar to Lisp, we ought to have a major mode to support it.
<= div>> > Would someone please work on that?
>
<= /div>
> I had brought this up in the recent clojure-ts-mode threa= d, that I
> assume you are referring to.  Sadly, I= have no experience with the
> language, but one idea m= ight be to extend lisp-data-mode by whatever the

I don't know if this counts as "work on that" but here's two inter= esting lines
Elisp:

  (d= efine-derived-mode clojure-mode lisp-data-mode "Clojure"
"= Barebones Clojure")
  (add-to-list 'auto-mode-alist '= ("\\.clj" . clojure-mode))

Since it is a li= sp dialect many things works here, like indentation,
symbo= l recognition, parenthesis balancing, C-M navigation, and thing-at-point= .

And then there's LSP, right?

So I installed clojure-lsp from here:

= I created a hello world project with the "lein" tool, git init, found th= e
src/helloworld/core.clj inside it, pressed M-x eglot and= suddenly I had
at-point-documentation, diagnostics, lots = of refactorings, completion, etc.

The thing= that's a bit minimal is the syntax highlighting, but it's
not that bad either IMHO. Eglot doesn't yet support LSP-mandated syntax=
highlighting.  I have no idea what it takes to add T= reeSitter support
to such a bare-bones mode (but shouldn't= it be really easy like mapping
syntactic symbols to faces= ?)

No idea if this works with the CIDER or = SLIME backends for clojure.
Don't ask me to test any more = cause I've just uninstalled it all
but any clojurians radi= ng can have a go.

Jo=C3=A3o
<= br>

Attachments:
  • clojur= e-mode-and-eglot.png

--5a738e83d1be4fcb9e5d4b1939f36dec--