Fork me on GitHub
#spacemacs
<
2019-07-13
>
practicalli-john17:07:48

All three pull requests I asked for feedback from have all been accepted and merged into develop branch. Thanks to everyone for your feedback.

🎉 4
practicalli-john17:07:45

If there any other aspects of the Clojure layer you think could be improved, feel free to discuss.

aisamu04:07:59

Perhaps bindings for the -up-to-point evaluation variants?

practicalli-john09:07:49

I believe one has just recently been added , e v, I was not aware of these, I will investigate. Any you particularly use?

aisamu03:07:13

There are only two, sexp and defun. They're useful to evaluate "incomplete" expressions, such as the first half of threading macro without having to comment all the remaining lines. I usually pick sexp (`C-c C-v C-o` is the default binding)

practicalli-john07:07:50

happy to add these bindings. what do you suggest? SPC m e p p for sexp (as its defalt) and SPC m e p f for defun?

practicalli-john17:07:44

I would like to understand what parts of the Clojure layer are most used, or possibly more importantly what do you not use or think should be changed.

practicalli-john17:07:16

I am especially curious about the keybindings under SPC m s - the repl part of the menu for the Clojure layer. There are quite a few 'send-to-repl' functions under that menu, do people actually use these?

kirill.salykin17:07:56

I miss a lot ability to send to level form inside comment exp

practicalli-john18:07:45

I typically comment individual lines with #_ comment reader macro.

practicalli-john18:07:12

With the (comment ,,, ) function, you can use the inline evaluation functions , e e - I use this on the next line after the expression I want to evaluate , e v on the opening paren of an expression

practicalli-john18:07:05

Would you be willing to elaborate on your workflow?

practicalli-john18:07:09

Is it something like this: 1) jack-in 2) , s s to open the repl buffer 3) write / navigate to code in source code buffer 4) , s f or , s e to evaluate code in the REPL buffer?

lispyclouds05:07:32

@U05254DQM I think what @U1V7K1YTZ is meaning to say is if I'm inside an sexp like (+ 1<here> 2) and want to evaluate the form to 3 I shouldn't have to go to the opening brace which , e v needs. Correct me if I'm wrong @U1V7K1YTZ as this is something I sorely need too 😞

👍 4
lispyclouds05:07:33

On a side note, do you have an idea how to do this @U05254DQM? 🙂

kirill.salykin06:07:55

Yes, this is correct. Thanks for explaining

lispyclouds08:07:00

cider-pprint-eval-defun-at-point kinda works for this case, but if im in a nested sexp like (def a (range 0<here> 5)) and I wanna see (0 1 2 3 4) as output, it evals the whole def form

practicalli-john09:07:53

, e v is in develop now for cider-pprint-eval-defun-at-point but as you say its not quite what you are wanting all the time. Its not something I do, perhaps #cider channel has some suggestions

jahson18:07:43

(comment
;; It's often convenient to send to repl instead of switching to it
;; so you can have all your research stuff in one place - the data, the flow
(def data {:some :data})
(call-some-fn-on data)
...
;; etc
)

practicalli-john18:07:29

@jahson So you prefer to send evaluation to the separate REPL buffer, rather than seeing the evaluation results inline in the source code buffer

jahson18:07:45

I think I got a part of this habit from vim's fireplace.

practicalli-john18:07:49

Very interesting, thanks for sharing. I think my preference for showing the evaluation results inline comes from LightTable

jahson19:07:15

I think I must elaborate on this. I've been used to opening the repl and writing code inside of the repl at the start. After that I've started to learn fireplacethings, like cqp to open a prompt and eval, or cpp to eval the innermost form. Eventually I've started working without repl being visible, only reaching it for cases when I've needed to work on some big structure that doesn't fit into vim's message area. Around that time I've got te gist of (comment), that it helps with not relying on repl history, that the data is more visible, and that the repetition is easier. Nowadays I often work without open repl, but I've seen many other people relying on repl being open.

jahson19:07:19

> Nowadays I often work without open repl, but I've seen many other people relying on repl being open. That means that I've prefer inline evaluation atm 🙂

practicalli-john19:07:01

Good to know, thanks. Do you ever use the #_ comment reader macro instead of (comment ). For example:

#_
(handy-funciton-helper arg)

practicalli-john19:07:30

Or comment out parts of an expression that is essentially a pipleline, like a threading macro

(->> book
     (re-seq #"[a-zA-Z0-9|']+" ,,,)
     (map #(clojure.string/lower-case %))
     #_(remove common-english-words)
     #_frequencies
     #_(sort-by val)
     #_reverse)

jahson19:07:54

For me the comment reader macro is like a comment. I think it should't get into vcs, like the other commented out code. OTOH the (comment) for me is like a playground that can be reused later. And it might get to vcs.

practicalli-john20:07:16

I use the #_ exactly as a playground and place that playground code at the bottom of the file, usually with a description of each expression and why its there.

jahson21:07:35

I should probably try this.

jahson19:07:29

I don't use this reader macro often, but I've seen people using it. I learned about this macro after about two years into clojure, so I'm not very used to it.

jahson19:07:42

To comment thing out I use comments 😉

jahson19:07:00

Like gcaf inside the form I need to comment.

practicalli-john19:07:30

I believe you can just use gcc if I understand you correctly

jahson19:07:15

No, the gcc comments the line iirc.

jahson19:07:05

The gcaf is a "phrase" = g c(omment) a(round) f(orm)

jahson19:07:22

I don't recall what is the g for.

practicalli-john19:07:01

Ah, yes, I wasnt using gacf on a nested function 🙂 I see what you mean now. Thats nice, I didnt know that (no vim background for me)

jahson19:07:04

And it will conveniently move the parentheses to the next line.

practicalli-john19:07:19

very nice 🙂 I will add that to my book...

jahson19:07:53

Just tried in vim: it's not so convenient and comments out everything, including the parentheses that shouldn't be commented.

jahson19:07:02

Just refreshed my memory: https://github.com/tpope/vim-commentary gc is the command, and the af is the motion.

practicalli-john19:07:41

Thanks. If you have any other vim-like things you find valuable in Spacemacs I would really like to hear about them. What I have learnt so far is on https://practicalli.github.io/spacemacs/editing/vim-style/speaking-evil.html and the following few pages.

jahson19:07:33

Sure. If I remember anything useful, I'll post it here. By the way thank you for your book, it helped me a couple of times.

👍 4
jahson21:07:04

I also often use the daf, dsf, caf, cif. The af and if text objects seems to be from https://github.com/luxbock/evil-cleverparens/blob/master/evil-cleverparens-text-objects.el

jahson21:07:53

I think there should be some kind of keypress tracker.

jahson21:07:14

Ah, it's called keyfreq.

aisamu04:07:59

Perhaps bindings for the -up-to-point evaluation variants?