Fork me on GitHub
#cider
<
2017-04-06
>
bozhidar08:04:02

well, yeah - it’s supposed to work like this

chrisblom12:04:11

is there a way to run cljr-clean-ns on all files in a project?

benedek13:04:56

you can also configure the list of fns to run

benedek13:04:12

in theory your own function could be included as well

chrisblom13:04:17

@benedek thanks, unfortunately I have some malformed clj files that keep cljr-project-clean from working, so used this snippet instead

chrisblom13:04:57

ok, next step. Is it possible to configure the format that cljr-clean-ns returns?

chrisblom13:04:05

basically, i just want a newline after :require

chrisblom13:04:15

this is very, very important to me

benedek13:04:47

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

benedek13:04:00

this is also controlled by refactor-nrepl not the elisp client

chrisblom13:04:21

ah bummer, i'll try with query-replace after running clean-ns

benedek13:04:30

i guess you can put together a bit of elisp to insert that newline

benedek13:04:59

exactly if you wrap it in function you can add it to the list of functions to run when cleaning the project

chrisblom13:04:02

ah good idea

chrisblom13:04:19

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)

qqq23:04:39

using helm, is there a way to imenu all of src/ ?

xiongtx01:04:59

NAFAIK. helm-imenu-in-all-buffers will imenu all buffers w/ the same major mode

qqq02:04:47

so this is for all buffers which means I need to open all the files in src/ first right ?

xiongtx06:04:11

And it will also include .clj files not part of your project

qqq23:04:48

right now, imenu only imenus the current .clj or .cljs file I am editing

qqq23:04:54

I want to imenu al .clj .cljc *.cljs files in src/

xiongtx21:04:30

Customize helm-imenu-all-buffers-assoc:

(add-to-list 'helm-imenu-all-buffer-assoc '(clojure-mode . clojurec-mode))
(add-to-list 'helm-imenu-all-buffer-assoc '(clojure-mode . clojurescript-mode))