Fork me on GitHub
#emacs
<
2018-01-29
>
vemv08:01:42

hi folks, anyone has specific tips for using cider/clj-refactor with mount? I had to wrestle quite a lot with an existing project before getting it to work flawlessly

vemv08:01:18

even then, if I (init) too fast (typical user.clj function), I will get errors like:

vemv08:01:41

user-error: Some namespaces are in a bad state: error "No namespace: x.y found" in x.y

vemv08:01:04

x.y being a ns that is generally correct

vemv08:01:11

so, my main concern is about race conditions. maybe I can teach mount lifecycle functions to wait till CIDER compilation is done? (if that makes sense. don't have a full picture of this project)

benedek09:01:35

you can mitigate this by not allowing cljr to build ASTs at start up

benedek09:01:43

so it pops up a question when you invoke a feature which does need it -- bit annoying but might be the right thing for your project

vemv09:01:05

good call @benedek! indeed there's a call to refresh in the project code

vemv09:01:31

is the need for refresh avoidable while still having the refactor-nrepl goodness? it would be frustrating if I had to choose one thing over the other

vemv09:01:21

> not allowing cljr to build ASTs at start up

vemv09:01:03

or conversely, I could build the ASTs in a controlled manner? as part of the Mount lifecycle functions?

benedek09:01:30

so there is a problem when the AST building is being done and you refresh meanwhile

vemv09:01:55

yes, that is my impression

vemv09:01:14

b/c it doesn't happen if I (init) after 30s. only if I do it asap

benedek09:01:30

you can either do the refresh latter or config off the eager AST building at start-up

benedek09:01:55

not mount specific btw same error can happen with system etc too unfortunately

vemv09:01:23

won't I lose accuracy/etc if I do the config-off?

benedek09:01:36

let me get some config options for you

benedek09:01:14

cljr will ask you when it needs ASTs if it can build them

benedek09:01:29

you loose a efficiency I guess

vemv09:01:47

gotchu, thanks!

vemv09:01:50

hopefully this could be automated as mentioned: reply 'yes' iff system is loaded

benedek09:01:40

so you want cljr-WARN-ON-EVAL (no caps sorry) to be 'T if you want to stop AST building at start up

benedek09:01:37

you cab set cljr--debug-mode to 't so cljr tells you when AST building is finished

benedek09:01:52

so you can deter refreshing till then

vemv09:01:24

:thumbsup: appreciated!

benedek09:01:37

hope this helps.

tianshu09:01:12

I'm trying to do some insertion and deletion in a post-command-hook function. after that, the undo-list is likely mess up. I want all the change made in post-command-hook and this-command, can be undo with one undo. have no idea how to do this. thanks for any help.

tianshu11:01:57

ok, the function which hook at post-command-hook will run again when undo.😂