Skip to content

Commit d6a43ee

Browse files
committed
x
1 parent 192a466 commit d6a43ee

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

clojure-mode.el

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

21122112
(defconst clojure-namespace-regexp
2113-
(rx line-start "(" (? "clojure.core/") (or "in-ns" "ns" "ns+") symbol-end))
2113+
(rx "(" (? "clojure.core/") (or "in-ns" "ns" "ns+") symbol-end))
21142114

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

test/clojure-mode-util-test.el

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,23 @@
125125
(with-clojure-buffer "(ns foo)
126126
(ns-unmap *ns* 'map)
127127
(ns.misleading 1 2 3)"
128+
(expect (clojure-find-ns) :to-equal "foo")))
129+
(it "should skip leading garbage"
130+
(with-clojure-buffer " (ns foo)"
131+
(expect (clojure-find-ns) :to-equal "foo"))
132+
(with-clojure-buffer "1(ns foo)"
133+
(expect (clojure-find-ns) :to-equal "foo"))
134+
(with-clojure-buffer "1 (ns foo)"
135+
(expect (clojure-find-ns) :to-equal "foo"))
136+
(with-clojure-buffer "1
137+
(ns foo)"
138+
(expect (clojure-find-ns) :to-equal "foo"))
139+
(with-clojure-buffer "[1]
140+
(ns foo)"
141+
(expect (clojure-find-ns) :to-equal "foo"))
142+
(with-clojure-buffer "[1] (ns foo)"
143+
(expect (clojure-find-ns) :to-equal "foo"))
144+
(with-clojure-buffer "[1](ns foo)"
128145
(expect (clojure-find-ns) :to-equal "foo"))))
129146

130147
(describe "clojure-sort-ns"
@@ -154,7 +171,7 @@
154171
;;[comment2]
155172
))")))
156173
(it "should sort requires in ns with copyright disclamer and comments"
157-
(with-clojure-buffer ";; Copyright (c) John Doe. All rights reserved.
174+
(with-clojure-buffer ";; Copyright (c) John Doe. All rights reserved.
158175
;; The use and distribution terms for this software are covered by the
159176
;; Eclipse Public License 1.0 (https://opensource.org/license/epl-1-0/)
160177
(ns clojure.core

0 commit comments

Comments
 (0)