[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Brand new clojure support in Emacs ;-)

From: Bozhidar Batsov
Subject: Re: Brand new clojure support in Emacs ;-)
Date: Sun, 03 Sep 2023 17:01:33 +0200
User-agent: Cyrus-JMAP/3.9.0-alpha0-701-g9b2f44d3ee-fm-20230823.001-g9b2f44d3

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 packages are definitely not the same thing as Clojure namespaces). Trying to change Common 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 as 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 very thin layer on top of lisp-mode and we had tweaked slightly inferior-lisp-mode to be used with Clojure. Similarly with SLIME + swank-clojure. Gradually clojure-mode became its own thing and CIDER and inf-clojure were 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=4X-1fJm25Ww

On Tue, Aug 29, 2023, at 11:09 PM, João Távora wrote:
On Fri, Aug 25, 2023 at 8:26 AM Philip Kaludercic <philipk@posteo.net> wrote:
> Richard Stallman <rms@gnu.org> 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 support 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

I don't know if this counts as "work on that" but here's two interesting lines

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

Since it is a lisp dialect many things works here, like indentation,
symbol 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 the
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 TreeSitter 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 rading can have a go.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]