Skip to content

Commit

Permalink
Use cider-sexp-at-point in cider-eval-sexp-at-point
Browse files Browse the repository at this point in the history
  • Loading branch information
Malabarba committed May 6, 2016
1 parent ec30c3d commit 2207619
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cider-interaction.el
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,7 @@ If invoked with a PREFIX argument, print the result in the current buffer."
If invoked with a PREFIX argument, print the result in the current buffer."
(interactive "P")
(save-excursion
(up-list)
(goto-char (cadr (cider-sexp-at-point 'bounds)))
(cider-eval-last-sexp prefix)))

(defun cider-eval-defun-to-comment (loc)
Expand Down

4 comments on commit 2207619

@terjesb
Copy link
Contributor

@terjesb terjesb commented on 2207619 Jul 25, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before this commit:

(inc (red| uce + [1 2 3])) => 6

After this commit:

(inc (red| uce + [1 2 3])) => #function[clojure.core/reduce]

Doesn't this commit break the intended functionality of C-c C-v v?

@Malabarba
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what the intended functionality is, but the symbol reduce is a sexp too, so it makes sense that eval-sexp-at-point inside reduce would evaluate the reduce.

@terjesb
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Malabarba What do you mean by evaluate the reduce? Right now, it simply evaluates the symbol at point, which seems not very useful imo. As far as I can tell, the motivating and intended addition in #1720 was to enable evaluation of the current form around point, e.g. (reduce + [1 2 3]).

@Malabarba
Copy link
Member Author

@Malabarba Malabarba commented on 2207619 Jul 25, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Evaluating symbols is useful too. :-)
I do that all the time to check the value of a var.

But I see your point about the original feature request. What I did now is not what was initially requested.
Additionally, If we want to evaluate the current form, then the previous code was also wrong, because the previous code would gladly evaluate something like [1 2 3] which is not a form.

Please sign in to comment.