Fork me on GitHub
#spacemacs
<
2018-09-24
>
kirill.salykin12:09:54

Hi, I am trying to set (setq cider-eval-toplevel-inside-comment-form t) inside user/config to evaluate inside comments expr, but it seems not working anyone has the same issues? (https://clojureverse.org/t/anyone-else-gets-annoyed-with-cider/2399/5)

practicalli-johnny14:09:22

@kirill.salykin I dont have the same problem, but that is because I use the reader macro #_ rather than (comment ). For example, #_(+ 1 2 3) instead of (comment (+ 1 2 3))

practicalli-johnny14:09:13

however, if you want to still use comment, I'll take a look.

kirill.salykin14:09:44

it would be nice…

practicalli-johnny14:09:48

did you try the other two setq functions and did they work?

kirill.salykin14:09:12

actually I didn’t

kirill.salykin14:09:29

maybe it is not right place to change cider..

practicalli-johnny14:09:18

It may be something simple like you have an older version of cider. For spacemacs, do you use the master branch or did you switch to the develop branch before first installing spacemacs

practicalli-johnny14:09:23

if you are not sure, you could also try calling the function cider-version, eg. SPC SPC cider-version

kirill.salykin14:09:26

I am on develop branc

kirill.salykin14:09:42

0.18.1 snapshot

practicalli-johnny14:09:32

oh, you are ahead of me for Cider, I'll have a look at updating my version today

practicalli-johnny14:09:42

Okay, so it seems you should have the version that has those pull request in. so maybe it is the way you are adding the setq code to dotspacemacs/user-config. did you just copy the line as is into this section?

kirill.salykin14:09:14

Also I put it i user-config

practicalli-johnny14:09:30

Did you evaluate the (setq cider-eval-toplevel-inside-comment-form t) expression, eg. with , e e or C-x C-e or reloading the .spacemacs config with SPC f e R or simply restarting Spacemacs?

kirill.salykin14:09:06

I restart spacemacs

kirill.salykin14:09:11

but didnt evaluate

kirill.salykin14:09:23

I’ll play with it in the evening

kirill.salykin14:09:39

with evaluation it will be way faster

jeff.terrell14:09:32

Kudos to @jr0cket for all the Spacemacs help! 👏

cider 4
practicalli-johnny15:09:34

Someone might think I was writing a book on Spacemacs 😉 https://practicalli.github.io/spacemacs/

simple_smile 4
practicalli-johnny14:09:46

The (setq cider-eval-toplevel-inside-comment-form t) didnt work for me, when testing on something simple like (comment (str "i am not a comment")). I am on version 0.18.0 but that should still have the June pull requests. I'll upgrade packages and see if that helps. If its not the version, then maybe it needs to be inside an add-hook function to avoid being overwritten when the Clojure layer lazily loads.

kirill.salykin14:09:42

possibly, i’ve been thinking about addhook as well

practicalli-johnny14:09:05

I'll try this add-hook config when i have updated the packages in spacemacs (as its still not working) https://gist.github.com/jr0cket/eeadeed6482149e23928d3354fc83e6c#file-spacemacs-el-L747-L749

kirill.salykin15:09:23

didn’t work for me as well

practicalli-johnny15:09:54

Nope, didnt work. Not sure why this is actually needed. If you put your cursor at the end of the line in Vim normal mode and evaluate with , e e then it will return the value of the expression inside the comment expression already

kirill.salykin15:09:15

I now eval region

kirill.salykin15:09:37

seems a bit faster to eval at defun

practicalli-johnny15:09:05

Ah yes, you can select an expression inside the comment function with SPC v and then evaluate the region with , e r, thats nice

practicalli-johnny15:09:34

Someone might think I was writing a book on Spacemacs 😉 https://practicalli.github.io/spacemacs/

simple_smile 4
practicalli-johnny15:09:14

@kirill.salykin If you are interested in using the #_ alternative to comment, I have a little function that toggles those characters and a keybinding to call it https://gist.github.com/90c415dbc268be32b3ffe16bf40012fc

Andrea Imparato15:09:09

is anybody having issues when printing large strings on the repl?

Andrea Imparato15:09:27

emacs gets very laggy when I do so 😕

Andrea Imparato15:09:40

I've been told it could be font-lock-mode

kirill.salykin16:09:56

Thanks for tip @jr0cket and thanks for the book, I think I read couple chapters

practicalli-johnny16:09:00

There is still a lot to add to the book and ideas are most welcome

practicalli-johnny16:09:59

@andrea.imparato if the repl if formatting that string then it could be font-lock. The repl should truncate results, so you must have some really big strings, so do you have any examples? I can parse a whole book and print it out in the repl without any real lag: https://github.com/practicalli/clojure-through-code/blob/master/src/clojure_through_code/xx-hhgttg-book.clj

practicalli-johnny16:09:28

If you are generating strings with code and want to see the results, you can also try , e P to print into a separate buffer. I am unsure if this will help with your lag though.

Andrea Imparato16:09:24

yep the repl is formatting the string because it's not a string, it's a huge map generated from a xml file

practicalli-johnny16:09:49

You can always toggle font-lock mode for a buffer via SPC SPC font-lock-mode

practicalli-johnny16:09:23

Ah, XML, that sounds like a challenge, especially if it is deeply nested

practicalli-johnny16:09:56

could you use https://clojuredocs.org/clojure.core/spit to push it to an external file and then look at it. Or just use the keys in the clojure map to check the parts you are interested in at any particular time.

practicalli-johnny16:09:13

using get-in really-big-map [:keys :to :interesting :part]