-
-
Notifications
You must be signed in to change notification settings - Fork 646
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
cider--goto-expression-start: Do not throw if bop #3309
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -602,8 +602,10 @@ until we find a delimiters that's not inside a string." | |
(if (and (looking-back "[])}]" (line-beginning-position)) | ||
(null (nth 3 (syntax-ppss)))) | ||
(backward-sexp) | ||
(while (or (not (looking-at-p "[({[]")) | ||
(nth 3 (syntax-ppss))) | ||
(while (and (not (bobp)) | ||
(or | ||
(not (looking-at-p "[({[]")) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also wonder why this check didn't get triggered in your example with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It short circuits to |
||
(nth 3 (syntax-ppss)))) | ||
(backward-char)))) | ||
|
||
(defun cider--find-last-error-location (message) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,4 +47,23 @@ | |
(insert "🍻")) | ||
(expect (cider-provide-file filename) :to-equal "8J+Nuw==")))) | ||
|
||
(describe | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It'd be good to add a few tests that also cover the normal behavior of this function. |
||
"cider--goto-expression-start" | ||
(it "Does not throw an error, when file does not contain a list" | ||
(expect | ||
(with-temp-buffer | ||
(insert "foo") | ||
;; After evaling, message: | ||
;; "Syntax error compiling at (foo.clj:0:0). | ||
;; Unable to resolve symbol: foo in this context | ||
;; " | ||
;; cider--find-last-error-location goes to location | ||
;; 0:0 and calls cider--goto-expression-start | ||
(goto-char (point-min)) | ||
;; no error | ||
(cider--goto-expression-start) | ||
'ok) | ||
:to-equal 'ok))) | ||
|
||
|
||
(provide 'cider-eval-tests) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking a bit more about the issue it seems to me the right place for this check is not the
while
loop, but rather the firstif
or even an otherif
. E.g. if you're at the beginning of the buffer there's no point to look for the start of an expression as you're already there.