Fork me on GitHub
#spacemacs
<
2017-04-25
>
rustam.gilaztdinov08:04:02

Hi, guys! Can someone help me with key bindings? I want to rebind 'cider-eval-defun-at-point from SPC m e f to SPC SPC I guess all magic happening in ~/.emacs.d/layers/+lang/clojure/packages.el?

rustam.gilaztdinov08:04:13

If anyone interested — just add in https://github.com/syl20bnr/spacemacs/blob/master/layers/+lang/clojure/packages.el#L98

(dolist (m '(clojure-mode
           clojurec-mode
           clojurescript-mode
           clojurex-mode
           cider-repl-mode
           cider-clojure-interaction-mode))
(spacemacs/set-leader-keys-for-major-mode m
	"," 'cider-eval-defun-at-point)
(mapc (lambda (x) (spacemacs/declare-prefix-for-mode
                   m (car x) (cdr x)))
      cider--key-binding-prefixes)
Now on s-exp simply type , , and it will be evaluated

rustam.gilaztdinov08:04:22

If add

(spacemacs/set-leader-keys-for-major-mode m
    "SPC" 'cider-eval-defun-at-point)
s-exp will work on SPC m SPC or , SPC I think , , — faster 😃

practicalli-john10:04:59

@rustam.gilaztdinov yes, I use a similar binding to show a commented result on evaluation "e;" 'cider-eval-defun-to-comment

practicalli-john10:04:36

@rustam.gilaztdinov you propose a nice binding with , ,, are you going to create a pull request to have it as part of the clojure layer? I am going to create a pull request for mine, but not until the weekend.

practicalli-john11:04:24

I would like to have a binding that inserts a #_ at the start of an expression, to comment out that expression. Is there such a function already?

bja14:04:58

I usually rebind C-c C-c to eval the current 'graph under point in whatever language I'm in

bja14:04:55

typically using emidln//generic-eval-operator and emidln//generic-send-operator, which is a function that sets up eval-sexp-fu overlays for each language. Then I rebind all of the eval/send functions in terms of the the generic operators. Makes it easy so I can just define an alist with mode and a function to take a region and eval/send it with all the plumbing taken care of.

bja14:04:24

but it's also nice to just have an operator in evil that I can compose up a custom selection and eval it

romain18:04:21

I have stable emacs-mac installed with brew. Do I need to reinstall it if I want to switch to HEAD ?

ag20:04:16

@romain use emacs-plus formula - especially if you’re using magit

practicalli-john14:04:44

I've seen quite a few people mention this issue. I don't use jump (although I should learn too). I'll take a look at the issue at the weekend (need to finish a presentation for a conference on Friday). Thanks

ag21:04:22

Thanks John, I thought I could work a workaround, turned out to be not so simple as it sounds - the way how Spacemacs handles “jumpers” is a bit tricky

practicalli-john19:05:10

hmm, you can use the function in cider to see if there is a current repl running: cider-connected-p but it seems you still need to check if the definitions are in the namespace if you want spacemacs/jump-to-definition to work

practicalli-john20:05:00

On the github issue I've added an example of a keybinding for the clojure layer that could detect the repl is running and use jump-to-definition if it is and fall back on dumb-jump-go if it is not

romain20:04:50

@ag I used emacs-plus, first I liked it seems heavier and less stable

romain20:04:05

I'm on a Macbook 15" mid 2012 with macos sierra

romain20:04:26

I went back on emacs-mac and it feels better

ag20:04:55

do you have osx layer added?

romain20:04:20

nop, last time I checked I didn't see something interesting

ag20:04:20

I had numerous problems with non-GNU versions, every time I try there’s something different. gnu cocoa version works fine for me. Although when installed on linux it feels way more smoother

romain20:04:53

I use only mac ☺️

ag20:04:41

do you use magit?

romain20:04:31

That's why I wanted to switch to HEAD 🙂

ag20:04:07

then you can just brew reinstall emacs-mac --HEAD