Skip to content

Commit 8652558

Browse files
author
Vadim Rodionov
committed
Make function definition regexp only look for 'clojure.core/defn' forms
1 parent 68e0e13 commit 8652558

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

clojure-mode.el

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -878,10 +878,9 @@ any number of matches of `clojure--sym-forbidden-rest-chars'."))
878878
"\\(?:#?^\\(?:{[^}]*}\\|\\sw+\\)[ \r\n\t]*\\)*"
879879
"\\(\\sw+\\)?")
880880
(2 font-lock-type-face nil t))
881-
;; Function definition (anything that starts with def and is not
882-
;; listed above)
883-
(,(concat "(\\(?:" clojure--sym-regexp "/\\)?"
884-
"\\(def[^ \r\n\t]*\\)"
881+
;; Function definition
882+
(,(concat "(\\(?:clojure.core/\\)?"
883+
"\\(defn\\)"
885884
;; Function declarations
886885
"\\>"
887886
;; Any whitespace

test/clojure-mode-font-lock-test.el

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -776,17 +776,17 @@ DESCRIPTION is the description of the spec."
776776
(6 42 clojure-keyword-face)))
777777

778778
(when-fontifying-it "should handle namespaced defs"
779-
("(_c4/defn bar [] nil)"
780-
(2 4 font-lock-type-face)
781-
(5 5 nil)
782-
(6 9 font-lock-keyword-face)
783-
(11 13 font-lock-function-name-face))
784-
785-
("(clo/defrecord foo nil)"
786-
(2 4 font-lock-type-face)
787-
(5 5 nil)
788-
(6 14 font-lock-keyword-face)
789-
(16 18 font-lock-function-name-face))
779+
("(clojure.core/defn bar [] nil)"
780+
(2 13 font-lock-type-face)
781+
(14 14 nil)
782+
(15 18 font-lock-keyword-face)
783+
(20 22 font-lock-function-name-face))
784+
785+
("(clojure.core/defrecord foo nil)"
786+
(2 13 font-lock-type-face)
787+
(14 14 nil)
788+
(15 23 font-lock-keyword-face)
789+
(25 27 font-lock-type-face))
790790

791791
("(s/def ::keyword)"
792792
(2 2 font-lock-type-face)

0 commit comments

Comments
 (0)