This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-01-29
Channels
- # babashka (4)
- # babashka-sci-dev (96)
- # beginners (79)
- # calva (26)
- # cider (5)
- # clerk (2)
- # clj-kondo (23)
- # clojars (14)
- # clojure (54)
- # clojure-europe (8)
- # clojure-sweden (3)
- # clojurescript (76)
- # datomic (12)
- # deps-new (6)
- # emacs (20)
- # events (3)
- # exercism (1)
- # fulcro (11)
- # funcool (12)
- # hugsql (14)
- # hyperfiddle (6)
- # kaocha (1)
- # lambdaisland (1)
- # lsp (22)
- # malli (1)
- # matcher-combinators (6)
- # nbb (6)
- # off-topic (128)
- # polylith (14)
- # re-frame (4)
- # reagent (1)
- # releases (4)
- # shadow-cljs (8)
- # tools-build (13)
- # tools-deps (13)
- # tree-sitter (5)
I would like to define both my clojurescript mode hooks and my clojure mode hooks in one go, as follows
(add-hook 'clojurescript-mode-hook 'clojure-mode-hook #'paredit-mode)
Just add paredit-mode
to clojure-mode-hook
. Since clojurescript-mode
is derived from clojure-mode
, it will inherit everything you add to clojure-mode-hook
.
however this does not work. how to do this?
I thought .cljs files already handled by clojure-mode. So one hook should suffice. I assume #’paredit-mode toggles paredit, so adding it to two modes then loading both modes will in effect leave paredit disabled. NOTE: This is just a guess. Someone please correct if I’m wrong
I am confused. Starting shadow-cljs with cider gives me a stale shadow-cljs warning, telling me that it was not built by this server, and asking me if the watch flag is running
I am in the correct repl
cljs.user> (shadow.cljs.devtools.api/watch :frontend)
No available JS runtime.
See
Runs fine from command line
I have selected the correct build
Can someone explain to me how formatting works in emacs when you have no custom formatter installed and are just using clojure-mode
?
Is there any custom clojure formatting going on, or is it using the same formatting as elisp?
I'm asking for @U7ERLH6JX since he wants to have the same formatting as I have.
I'm also fine with going with cljfmt
and having lsp-format-buffer
do this for me, but I'm not sure if cljfmt
is broadly supported in other editors?
I use these settings for CIDER
(setq clojure-indent-style 'align-arguments
clojure-align-forms-automatically t
clojure-toplevel-inside-comment-form t ;; evaluate expressions in comment as top level
)
And cljfmt seems to do everything else (although I usually run formatting through cljstyle before committing- using this https://github.com/practicalli/clojure-deps-edn/blob/live/.cljstyleThe https://github.com/clojure-emacs/clojure-mode/#configuration to understand what Emacs Cider does.
I was looking through the source and was searching for format
but indent
makes more sense and comes up with lots more elisp - makes sense now
Just to pile on, I have this bit of elisp in my config for Compojure. As clojure-mode and clj-fmt have different ideas on how to indent them (I use clojure-mode to indent while developing, but our CI/CD pipeline uses clj-fmt in strict mode 😅 )
;; Indentation rules for Compojure Macros (they are a bit special)
;; From
;; using the syntax defined in
(define-clojure-indent
(ANY 2)
(DELETE 2)
(GET 2)
(HEAD 2)
(OPTIONS 0)
(PATCH 2)
(POST 2)
(PUT 2)
(context 2)
(defroutes 0)
(let-routes 1)
(rfn 0))