Fork me on GitHub
#emacs
<
2019-05-27
>
anish04:05:46

I want to copy expression when my cursor at the start of it, same as that for function when my cursor is at the start, any ideas?

anish04:05:58

To be more clear about question, e.g Ctrk-k , kills expression, instead of killing i want to copy it

Felipe Oliveira05:05:51

I believe the Emacs way is to mark to the end of line and copy with C-SPC C-e M-w or to mark the sexp and copy with C-@ M-w. That said, Smartparens has a function called sp-copy-sexp (by default bound to C-M-w) that does what you want. In Spacemacs it is bound to SPC k y in Evil (actually it is evil-lisp-state-sp-copy-sexp) and M-m k y in Holy.

anish05:05:44

e.g if i have function like

anish05:05:49

(defn some-func [] (-> (call-func) (:body) (json/read-str)))

anish05:05:49

and want to copy from threading macro what i need to do is , Ctl-Space, then end of read-str paren and M-w to copy

anish05:05:57

But what i would like to copy threading macro expression itself without going end of expression

Felipe Oliveira06:05:53

Hmm, do you know a package called expand region?

anish06:05:12

looking into it

Felipe Oliveira06:05:39

I believe that is what most people would use to do what you want. Inside an expression, it allows you to expand selection by container. I can't live without it. 🙂

anish06:05:27

Thank you !! 🙂

Felipe Oliveira06:05:51

In Spacemacs it is in SPC v, so you can keep pressing v to expand until you reach the scope you want and then finally copy it.

anish06:05:38

its awesome, i don’t know why i didnt know lol

Felipe Oliveira06:05:59

Yeah, there is always another package that we should be using.

Felipe Oliveira05:05:51

I believe the Emacs way is to mark to the end of line and copy with C-SPC C-e M-w or to mark the sexp and copy with C-@ M-w. That said, Smartparens has a function called sp-copy-sexp (by default bound to C-M-w) that does what you want. In Spacemacs it is bound to SPC k y in Evil (actually it is evil-lisp-state-sp-copy-sexp) and M-m k y in Holy.

anthony-galea12:05:30

Perhaps someone else has a use for this: I wrote an elisp function that converts the contents of cljx files to use reader conditionals: https://github.com/anthonygalea/cljx/blob/master/cljx.el#L31 Tried it on timbre https://github.com/ptaoussanis/timbre/pull/288/files Feedback welcome.

theeternalpulse17:05:20

Is there a better formatted stack trace in emacs. I'm getting long lines spanning far outside the window and it's hard to keep track if it's debugging a long var value. Some form of bette rnavigation buffer or pretty print