Skip to content

Commit e32c64d

Browse files
yuhan0bbatsov
authored andcommitted
Fix ns detection with namespaces containing numbers
1 parent 2d5456d commit e32c64d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

clojure-mode.el

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1923,10 +1923,8 @@ DIRECTION is `forward' or `backward'."
19231923
(save-match-data
19241924
(goto-char end)
19251925
(clojure-forward-logical-sexp)
1926-
(when (and (looking-back clojure--sym-regexp end 'greedy)
1927-
(not (clojure--in-string-p))
1928-
(not (clojure--in-comment-p)))
1929-
(setq candidate (match-string-no-properties 0)))))))
1926+
(unless (or (clojure--in-string-p) (clojure--in-comment-p))
1927+
(setq candidate (thing-at-point 'symbol)))))))
19301928
candidate))
19311929

19321930
(defun clojure-find-ns ()

test/clojure-mode-util-test.el

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@
9292
(with-clojure-buffer "(ns foo+)"
9393
(expect (clojure-find-ns) :to-equal "foo+"))
9494
(with-clojure-buffer "(ns bar**baz$-_quux)"
95-
(expect (clojure-find-ns) :to-equal "bar**baz$-_quux")))
95+
(expect (clojure-find-ns) :to-equal "bar**baz$-_quux"))
96+
(with-clojure-buffer "(ns aoc-2019.puzzles.day14)"
97+
(expect (clojure-find-ns) :to-equal "aoc-2019.puzzles.day14")))
9698
(it "should support in-ns forms"
9799
(with-clojure-buffer "(in-ns 'bar.baz)"
98100
(expect (clojure-find-ns) :to-equal "bar.baz")))

0 commit comments

Comments
 (0)