This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-04-06
Channels
- # architecture (2)
- # aws (6)
- # bangalore-clj (3)
- # beginners (7)
- # boot (29)
- # cider (26)
- # cljs-dev (52)
- # cljsrn (1)
- # clojure (249)
- # clojure-dev (9)
- # clojure-italy (2)
- # clojure-norway (3)
- # clojure-russia (178)
- # clojure-uk (30)
- # clojureremote (6)
- # clojurescript (91)
- # core-async (4)
- # cursive (8)
- # datascript (3)
- # datavis (1)
- # datomic (6)
- # emacs (3)
- # figwheel (2)
- # hoplon (14)
- # incanter (6)
- # luminus (8)
- # mount (7)
- # off-topic (22)
- # om (25)
- # onyx (41)
- # pedestal (7)
- # re-frame (9)
- # ring (1)
- # spacemacs (4)
- # sql (1)
- # uncomplicate (1)
- # unrepl (37)
- # untangled (90)
- # yada (77)
i think that is what https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-project-clean is for
@benedek thanks, unfortunately I have some malformed clj files that keep cljr-project-clean from working, so used this snippet instead
that is rather clean-ns really i guess. which is very opinionated on formatting. there are few config options but inserting newline after :require
is not one of them unfortunately
exactly if you wrap it in function you can add it to the list of functions to run when cleaning the project
Not pretty, but i got something working
(defun add-newline-after-require ()
(interactive)
(condition-case ex
(save-excursion
(goto-char 0)
(re-search-forward (rx
"(:require"
(+ (or "\n" space))
"["))
(backward-char)
(just-one-space -1)
(newline)
(indent-region
(save-excursion (cljr--goto-ns) (point))
(save-excursion (cljr--goto-ns) (forward-char) (paredit-close-parenthesis) (point))))
('search-failed nil)))
(advice-add 'cljr-clean-ns :after 'add-newline-after-require)