-
-
Notifications
You must be signed in to change notification settings - Fork 248
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
Fix clojure-find-ns when preceded by other forms #664
Conversation
6655971
to
ced0077
Compare
clojure-mode.el
Outdated
@@ -2270,6 +2270,16 @@ This will skip over sexps that don't represent objects, so that ^hints and | |||
(backward-sexp 1)) | |||
(setq n (1- n)))))) | |||
|
|||
(defun clojure--is-top-level-form-p (&optional point) |
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.
What's the difference with clojure-top-level-form-p
? It's a bit confusing to have 2 very similarly named functions IMO.
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.
clojure--is-top-level-form-p
checks if the sexp following the point is a top level form.
clojure-top-level-form-p
checks the type of enclosing top level form w.r.t current point.
ex:
|(ns foo)
-> (clojure--is-top-level-form-p)
returns true.
(|ns foo)
-> (clojure--is-top-level-form-p)
returns nil.
(comment |(ns foo))
-> (clojure--is-top-level-form-p)
returns nil.
(comment (|ns foo))
-> (clojure-top-level-form-p "comment")
returns true.
Added some unit tests now for clojure--is-top-level-form-p
.
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.
I'd suggest naming it clojure--looking-at-top-level-form
This would be consistent in name and semantics with looking-at
, I believe.
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.
Renamed the fn to clojure--looking-at-top-level-form
.
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.
Fantastic work, kudos!
Closes #656
Follow-up for #661