This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-08-02
Channels
- # announcements (6)
- # beginners (35)
- # calva (5)
- # cider (3)
- # clj-http (1)
- # clj-kondo (52)
- # clojure (51)
- # clojure-conj (2)
- # clojure-europe (28)
- # clojure-losangeles (1)
- # clojure-norway (8)
- # clojure-uk (2)
- # cursive (12)
- # datalevin (2)
- # datomic (38)
- # emacs (7)
- # events (5)
- # gratitude (1)
- # humbleui (7)
- # hyperfiddle (23)
- # jobs (1)
- # off-topic (6)
- # portland-or (1)
- # rdf (3)
- # releases (2)
- # xtdb (3)
How can I customize the default template used when a new clojure file is created? Right now, when I create a new file myapp/src/package/a.clj, it simply creates this
(ns package.a)
I would like to add (set! *warn-on-reflection* true)
to it
(ns package.a)
(set! *warn-on-reflection* true)
If you are using clojure-lsp that is likely what is adding the initial ns form and I don't believe it is configurable
cljr--add-ns-if-blank-clj-file
is very simple to understand
Currently it doesn't have a place to add that
PR welcome for allowing a defcustom specifying arbitrary contents after the ns. Could be a lambda taking a hashmap as arguments (currently with only one key, namely is-test-ns
)
No idea if this is useful for anyone, but I just cobbled together something for testing things mentioned in org docs. Given something like this in an org
file
#+name: My Test
#+begin_src clojure -t :results silent
(+ 1 2)
;; =>
5
#+end_src
a quick one-liner of
awk 'BEGIN { P=0 ; NAME="" } { if (tolower($0) ~ /^..name: /) {split($0,a,":") ; NAME=a[2] } else { if (tolower($0) ~ /^..begin_src *clojure.*-t/) { P=1 } else { if ($0 ~ /^..end_src/) { if (P > 0) { print "(if (not= *1 *2) (throw (new AssertionError (str \"FAIL" NAME " expected: \\n\" (pr-str *1) \"\\n\\nactual:\n\" (pr-str *2) \"\\n\\n\"))))\n\n" } ; P=0 ; NAME="" } ; if (P > 0) { print $0 } } } } ' `find . -iname '*.org'` | clojure >/dev/null
spits out error messages like
Execution error (AssertionError) at user/eval3 (REPL:1).
FAIL My Test expected:
5
actual:
3
Not made it actually fail the build yet, but I'm sure that'll not be too hard. Is anyone else doing something better than this for keeping docs up to date?