Skip to content
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 #3754] Fix regex in cider-ns-from-p. #3756

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## master (unreleased)

### Changes

- [#3754](https://github.com/clojure-emacs/cider/issues/3754): Fix regex in `cider-ns-from-p`.
- [#3753](https://github.com/clojure-emacs/cider/pull/3753): Add `cider-log-show-frameworks` command to show available log frameworks in a buffer.
- [#3746](https://github.com/clojure-emacs/cider/issues/3746): Bring back `cider` completion style for activating backend-driven completion.

Expand Down
2 changes: 1 addition & 1 deletion cider-client.el
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ EVAL-BUFFER is the buffer where the spinner was started."
;;; Evaluation helpers
(defun cider-ns-form-p (form)
"Check if FORM is an ns form."
(string-match-p "^[[:space:]]*\(ns\\([[:space:]]*$\\|[[:space:]]+\\)" form))
(string-match-p "\\`[[:space:]]*\(ns\\([[:space:]]*$\\|[[:space:]]+\\)" form))

(defun cider-ns-from-form (ns-form)
"Get ns substring from NS-FORM."
Expand Down
11 changes: 11 additions & 0 deletions test/cider-client-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,17 @@
(expect (cider-ensure-op-supported "foo")
:to-throw 'user-error)))

(describe "cider-ns-form-p"
(it "doesn't match ns in a string"
(let ((ns-in-string "\"\n(ns bar)\n\""))
(expect (cider-ns-form-p ns-in-string) :to-equal nil)))
(it "matches ns"
(let ((ns "(ns bar)\n"))
(expect (cider-ns-form-p ns) :to-equal 0)))
(it "matches ns with leading spaces"
(let ((ns " (ns bar)\n"))
(expect (cider-ns-form-p ns) :to-equal 0))))

(describe "cider-expected-ns"
(before-each
(spy-on 'cider-connected-p :and-return-value t)
Expand Down
Loading