emacs-devel
[Top][All Lists]
Advanced

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

Re: Brand new clojure support in Emacs ;-)


From: João Távora
Subject: Re: Brand new clojure support in Emacs ;-)
Date: Fri, 01 Sep 2023 11:14:14 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Richard Stallman <rms@gnu.org> writes:

> packages you used, so I don't know what they do.  More crucially, for
> most of them I can't tell whether they are part of Emacs or not.
> (They might be in NonGNU ELPA, or not connected with Emacs at all.)
> Could you please describe that status?

OK.  Here are the ingredients:

1. Emacs (you know this one)

2. lisp-data-mode (a part of core Emacs)
  
3. Eglot (already a part of core Emacs).  Eglot is an LSP client.  Read
   Emacs's manual on Eglot for what LSP is and what it does

4. clojure-lsp (not a part of Emacs) an MIT-licensed Language server.
   An external program, which most likely requires a Java runtime
   environment (JRE).  This external program is meant to run as an
   inferior process to Emacs.  Again, read Emacs's manual on Eglot to
   learn what a language server provides and how it communicates with
   Emacs.

You've read the full code to the proposed Clojure mode already.  Here it
is again:

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

Now, if you only use ingredients 1 and 2 this brand new Clojure mode is
reasonably poor in functionality, but it's still useful.  Sexp-based
navigation and editing works as always, as does parenthesis matching and
highlighting.  There is very basic syntax highlighting.  Not much more,
because you are looking at Clojure code as Lisp-style forms (as happens
with all Lisps).

When you add ingredients 3 and 4 (Eglot and the clojure-lsp server), the
major mode is enhanced by them and becomes vastly more powerful.  You
get

a. at-point documentation in the style of Eldoc
b. cross-referencing capabilities (find definitions/references)
   in the style of 80's Lisp machines
c. in-buffer annotations of syntactic errors and other problems
d. context-sensitive completion
e. refactoring actions
f. probably a lot more stuff

I don't know how this compares to the NonGNU Clojure mode because I've
never really used it.  That NonGNU Clojure mode can certainly also be
enhanced with LSP

João



reply via email to

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