-
-
Notifications
You must be signed in to change notification settings - Fork 649
Add feature to evaluate list around point #2881
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add feature to evaluate list around point #2881
Conversation
Isn't |
No: as I understand, a symbol is also a sexp in the implementation, so if point is on a symbol, that symbol gets evaluated, not the surrounding list. list-at-point will expand to include the innermost surrounding paren pair, and sends that whole thing ("compound form"?) to eval. |
Yeah, I think you're right. I use only eval-last-sexp and eval-defun, so my memory on everything else is fuzzy. I'll merge this as is and I'll add a couple of tests myself. Thanks! |
Amazing - thanks a lot, @bbatsov! |
New command added to CIDER in version 0.26 to evaluate the list around the current point, different to evaluate sexp around point which also evaluates symbols. clojure-emacs/cider#2881
New command added to CIDER in version 0.26 to evaluate the list around the current point, different to evaluate sexp around point which also evaluates symbols. clojure-emacs/cider#2881
New command added to CIDER in version 0.26 to evaluate the list around the current point, different to evaluate sexp around point which also evaluates symbols. clojure-emacs/cider#2881
New command added to CIDER in version 0.26 to evaluate the list around the current point, different to evaluate sexp around point which also evaluates symbols. clojure-emacs/cider#2881
New command added to CIDER in version 0.26 to evaluate the list around the current point, different to evaluate sexp around point which also evaluates symbols. clojure-emacs/cider#2881
New command added to CIDER in version 0.26 to evaluate the list around the current point, different to evaluate sexp around point which also evaluates symbols. clojure-emacs/cider#2881
This adds a new function cider-eval-list-at-point, that evaluates a list around point [as in: code delimited by the nearest pair of parens surrounding point]. This comes handy to evaluate a function call while the point is anywhere within the function call.
It's modelled after the eval-sexp-at-point solution, and as such, deals with the "deref @" and other quirks intelligently.
In terms of the implementation, it's built on a thingatpoint built-in feature, so no magic text manipulation is happening. Although the thingatpoint code targets Emacs Lisp, it should work fine with Clojure code too.
Sorry, no tests (yet) - I'd appreciate some help or guidance on what to cover for this.
Before submitting the PR make sure the following things have been done (and denote this
by checking the relevant checkboxes):
make test
)make lint
) which is based onelisp-lint
and includescheckdoc
, check-declare, packaging metadata, indentation, and trailing whitespace checks.Thanks!
If you're just starting out to hack on CIDER you might find this section of its
manual extremely useful.