Skip to content

Commit c970c46

Browse files
yuhan0bbatsov
authored andcommitted
Fix ns detection bug
The new regex was missing symbol-end, causing it to match (ns-... functions
1 parent 7adf9a6 commit c970c46

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

clojure-mode.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1924,7 +1924,7 @@ content) are considered part of the preceding sexp."
19241924
(make-obsolete-variable 'clojure-namespace-name-regex 'clojure-namespace-regexp "5.12.0")
19251925

19261926
(defconst clojure-namespace-regexp
1927-
(rx line-start "(" (? "clojure.core/") (or "in-ns" "ns" "ns+")))
1927+
(rx line-start "(" (? "clojure.core/") (or "in-ns" "ns" "ns+") symbol-end))
19281928

19291929
(defcustom clojure-cache-ns nil
19301930
"Whether to cache the results of `clojure-find-ns'.

test/clojure-mode-util-test.el

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,11 @@
109109
|
110110
(ns foo4)"
111111
(re-search-backward "|")
112-
(expect (clojure-find-ns) :to-equal "foo3"))))
112+
(expect (clojure-find-ns) :to-equal "foo3"))
113+
(with-clojure-buffer "(ns foo)
114+
(ns-unmap *ns* 'map)
115+
(ns.misleading 1 2 3)"
116+
(expect (clojure-find-ns) :to-equal "foo"))))
113117

114118
(describe "clojure-sort-ns"
115119
(it "should sort requires in a basic ns"

0 commit comments

Comments
 (0)