Skip to content

Commit 2a3a0e8

Browse files
committed
Improve clojure-find-def matching (support hyphens)
Custom def... macros might contain hyphens (e.g. defxxx-yyy).
1 parent b304afd commit 2a3a0e8

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Diff for: clojure-mode.el

+1-1
Original file line numberDiff line numberDiff line change
@@ -1103,7 +1103,7 @@ Useful if a file has been renamed."
11031103
Returns a list pair, e.g. (\"defn\" \"abc\") or (\"deftest\" \"some-test\")."
11041104
(let ((re (concat "(\\(?:\\(?:\\sw\\|\\s_\\)+/\\)?"
11051105
;; Declaration
1106-
"\\(def\\sw*\\)\\>"
1106+
"\\(def\\(?:\\sw\\|\\s_\\)*\\)\\>"
11071107
;; Any whitespace
11081108
"[ \r\n\t]*"
11091109
;; Possibly type or metadata

Diff for: test/clojure-mode-font-lock-test.el

+6
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,12 @@ POS."
214214
(should (eq (clojure-test-face-at 2 14) 'font-lock-keyword-face))
215215
(should (eq (clojure-test-face-at 16 18) 'font-lock-function-name-face))))
216216

217+
(ert-deftest clojure-mode-syntax-table/custom-def-with-special-chars3 ()
218+
:tags '(fontification syntax-table)
219+
(clojure-test-with-temp-buffer "(def-something foo [x] x)"
220+
(should (eq (clojure-test-face-at 2 14) 'font-lock-keyword-face))
221+
(should (eq (clojure-test-face-at 16 18) 'font-lock-function-name-face))))
222+
217223
(ert-deftest clojure-mode-syntax-table/lambda-params ()
218224
:tags '(fontification syntax-table)
219225
(clojure-test-with-temp-buffer "#(+ % %2 %3)"

0 commit comments

Comments
 (0)