Skip to content

Commit f98d548

Browse files
committed
Move clojure-namespace-name-regex closer to its usage
1 parent d355558 commit f98d548

File tree

1 file changed

+18
-20
lines changed

1 file changed

+18
-20
lines changed

clojure-mode.el

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,26 +1217,6 @@ nil."
12171217

12181218

12191219

1220-
(defconst clojure-namespace-name-regex
1221-
(rx line-start
1222-
"("
1223-
(zero-or-one (group (regexp "clojure.core/")))
1224-
(zero-or-one (submatch "in-"))
1225-
"ns"
1226-
(zero-or-one "+")
1227-
(one-or-more (any whitespace "\n"))
1228-
(zero-or-more (or (submatch (zero-or-one "#")
1229-
"^{"
1230-
(zero-or-more (not (any "}")))
1231-
"}")
1232-
(zero-or-more "^:"
1233-
(one-or-more (not (any whitespace)))))
1234-
(one-or-more (any whitespace "\n")))
1235-
(zero-or-one (any ":'")) ;; (in-ns 'foo) or (ns+ :user)
1236-
(group (one-or-more (not (any "()\"" whitespace))) symbol-end)))
1237-
1238-
1239-
12401220
(defun clojure-project-dir (&optional dir-name)
12411221
"Return the absolute path to the project's root directory.
12421222
@@ -1292,6 +1272,24 @@ Useful if a file has been renamed."
12921272
(replace-match nsname nil nil nil 4)
12931273
(error "Namespace not found")))))))
12941274

1275+
(defconst clojure-namespace-name-regex
1276+
(rx line-start
1277+
"("
1278+
(zero-or-one (group (regexp "clojure.core/")))
1279+
(zero-or-one (submatch "in-"))
1280+
"ns"
1281+
(zero-or-one "+")
1282+
(one-or-more (any whitespace "\n"))
1283+
(zero-or-more (or (submatch (zero-or-one "#")
1284+
"^{"
1285+
(zero-or-more (not (any "}")))
1286+
"}")
1287+
(zero-or-more "^:"
1288+
(one-or-more (not (any whitespace)))))
1289+
(one-or-more (any whitespace "\n")))
1290+
(zero-or-one (any ":'")) ;; (in-ns 'foo) or (ns+ :user)
1291+
(group (one-or-more (not (any "()\"" whitespace))) symbol-end)))
1292+
12951293
(defun clojure-find-ns ()
12961294
"Return the namespace of the current Clojure buffer.
12971295
Return the namespace closest to point and above it. If there are

0 commit comments

Comments
 (0)