Fork me on GitHub
#cider
<
2016-06-22
>
josh.freckleton19:06:09

cider freebie: Sometimes I'll be working in a (defn f ...) and want to eval (f ...), and it sucks navigating back and forth, so I wrote this for my emacs config. C-c C-v evals the next sexp: Any recommendations for improving it?

(defun cider-eval-next-sexp ()
  ;; useful where I'm working in `(defn f ...)` and want to evan the following `(f ...)`
  (interactive)
  (save-excursion
    (setq go-up t)
    (while go-up
      (condition-case nil ; go forward-up as far as you can
          (paredit-forward-up)
        (error (setq go-up nil))))
    (paredit-forward) ; go to the next sexp
    (cider-eval-last-sexp) ;eval it
    ))
(define-key cider-mode-map (kbd "C-c C-v") nil) ; overwrite cider's use of C-c C-v
(global-set-key (kbd "C-c C-v") 'cider-eval-next-sexp)