emacs

Consider also joining #cider, #lsp and #inf-clojure, where most of the tool-specific discussions are happening.
Mark Naylor 2020-12-27T20:46:15.336400Z

Why does emacs put an empty (ns ) definition at the beginning of any newly created *.clj file? Can it be overridden? Version: GNU Emacs 26.3 (build 1, x86_64-slackware-linux-gnu, GTK+ Version 3.18.9) of 2019-08-29

bartuka 2020-12-28T17:17:08.341100Z

@jr0cket it is not always populated. If you create a empty folder and add a core.cljfile in there, it will create the (ns )

bartuka 2020-12-28T17:17:36.341300Z

I believe the plugin needs to find a "valid" project structure (either deps or lein) so it can work properly.

practicalli-john 2020-12-28T17:30:00.341600Z

@iagwanderson that makes sense, if you dont have a valid project structure you dont get a valid namespace definition. It seems I've always used valid projects 🙂 Do people still use core.clj, I though that convention had been dropped a long time ago?

🙂 1
bartuka 2020-12-28T17:31:51.341800Z

lein new <projName> still creates the core.clj file by default

😭 1
Mark Naylor 2020-12-28T22:00:38.342300Z

Thank you for all the responses. I sent the clojure-mode maintainer an email; he pointed me to the clj-refactor functions and hooks. Since I was creating the new file in elisp, I shadowed the cljr-add-ns-to-blank-clj-files variable in a let* block.

👍 2
Mark Naylor 2020-12-29T18:12:24.342900Z

@jr0cket I have leinengen 2.9.1, and it still creates core modules.

1
ericdallo 2020-12-27T20:51:17.336500Z

This is done by clj-refactor (and if you use clojure-lsp)

ericdallo 2020-12-27T20:52:46.336800Z

You can disable it for clj-refactor setting

(setq cljr-add-ns-to-blank-clj-files nil)

ericdallo 2020-12-27T20:53:33.337Z

and for clojure-lsp adding to your config.edn :

{:auto-add-ns-to-new-files? false}

practicalli-john 2020-12-27T23:06:16.340200Z

clj-refactor has always added a populated namespace definition when used without clojure-lsp Is there some conflict here between the two?

ericdallo 2020-12-27T23:07:59.340400Z

if you have enabled both flags, it will add duplicated ns, that's why we added to clojure-lsp the flag to disable it too

2020-12-27T23:35:13.340700Z

Yeah, that is definitely not stock Emacs doing that for you, for sure. Mine doesn't.