@@ -1033,9 +1033,10 @@ by extracting all parent let bindings."
1033
1033
(setq res (concat (buffer-substring-no-properties beg end) " , " res)))))
1034
1034
(scan-error res)))))
1035
1035
1036
- (defun cider--eval-in-context (code &optional guess )
1037
- " Evaluate CODE in user-provided evaluation context."
1038
- (let* ((code (string-trim-right code))
1036
+ (defun cider--eval-in-context (bounds &optional guess )
1037
+ " Evaluate code at BOUNDS in user-provided evaluation context."
1038
+ (let* ((code (string-trim-right
1039
+ (buffer-substring-no-properties (car bounds) (cadr bounds))))
1039
1040
(eval-context
1040
1041
(minibuffer-with-setup-hook (when guess #'beginning-of-buffer )
1041
1042
(read-string " Evaluation context (let-style): "
@@ -1045,7 +1046,7 @@ by extracting all parent let bindings."
1045
1046
(setq-local cider-previous-eval-context eval-context)
1046
1047
(cider-interactive-eval code
1047
1048
nil
1048
- nil
1049
+ bounds
1049
1050
(cider--nrepl-pr-request-map))))
1050
1051
1051
1052
(defun cider-eval-last-sexp-in-context (guess )
@@ -1056,7 +1057,7 @@ The context is remembered between command invocations.
1056
1057
When GUESS is non-nil, or called interactively with \\ [universal-argument],
1057
1058
attempt to guess the context from parent let bindings."
1058
1059
(interactive " P" )
1059
- (cider--eval-in-context (cider-last-sexp) guess))
1060
+ (cider--eval-in-context (cider-last-sexp 'bounds ) guess))
1060
1061
1061
1062
(defun cider-eval-sexp-at-point-in-context (guess )
1062
1063
" Evaluate the sexp around point in user-supplied context.
@@ -1067,7 +1068,7 @@ The context is remembered between command invocations.
1067
1068
When GUESS is non-nil, or called interactively with \\ [universal-argument],
1068
1069
attempt to guess the context from parent let bindings."
1069
1070
(interactive " P" )
1070
- (cider--eval-in-context (cider-sexp-at-point) guess))
1071
+ (cider--eval-in-context (cider-sexp-at-point 'bounds ) guess))
1071
1072
1072
1073
(defun cider-eval-defun-to-comment (&optional insert-before )
1073
1074
" Evaluate the \" top-level\" form and insert result as comment.
0 commit comments