I'm new to Emacs (after 10+ years of Vim) and want to use it primarily for clojure.
Coming from Lighttable, one thing I absolute liked was the way it evaluated just the right sections of code no matter where I am. This is basically: Evaluating a paragraph surrounding the cursor position. Some examples (||
represents the cursor, $FROM ... TO$
represents what I'd like to have evaluated):
(comment
$FROM
(my-func ||[:test :one])
(xy)TO$
$FROM
(defn [y]
(let [x y]
(println|| "xy")))
)TO$
)
So basically I want to evaluate the paragraph (Note: Not necessarily a top level form since I surround them in (comment)
). I have no knowledge of Elisp. I tried this as an effort.
(defun my-cider-eval-paragraph ()
(interactive )
(safe-excursion
(mark-paragraph)
(command-execute 'cider-eval-region)))
But I'm clearly making many mistakes. Edit: Actually, my example works if I just change safe-excursion
to save-excursion
. Funny, I actually think both spellings makes sense.
Thanks for reading.