@@ -823,9 +823,46 @@ any number of matches of `clojure--sym-forbidden-rest-chars'.")
823
823
Matches the rule `clojure--keyword-sym-forbidden-1st-chars' followed by
824
824
any number of matches of `clojure--sym-forbidden-rest-chars' ." ))
825
825
826
+ (defcustom clojure-font-lock-def-forms
827
+ '(" def"
828
+ " defonce"
829
+ " defn"
830
+ " defn-"
831
+ " defmacro"
832
+ " definline"
833
+ " defmulti"
834
+ " defmethod"
835
+ " defprotocol"
836
+ " definterface"
837
+ " defrecord"
838
+ " deftype"
839
+ " defstruct"
840
+ ; ; clojure.test
841
+ " deftest"
842
+ " deftest-"
843
+ ; ; clojure.logic
844
+ " defne"
845
+ " defnm"
846
+ " defnu"
847
+ " defnc"
848
+ " defna"
849
+ ; ; Third party
850
+ " deftask"
851
+ " defstate" )
852
+ " List of strings identifying def forms."
853
+ :package-version '(clojure-mode . " 5.16" )
854
+ :safe #'listp
855
+ :type '(repeat string))
856
+
826
857
(defconst clojure-font-lock-keywords
827
858
(eval-when-compile
828
- `( ; ; Top-level variable definition
859
+ `(; ; Any def form
860
+ (,(concat " (\\ (?:" clojure--sym-regexp " /\\ )?"
861
+ " \\ ("
862
+ (regexp-opt clojure-font-lock-def-forms)
863
+ " \\ )\\ >" )
864
+ (1 font-lock-keyword-face ))
865
+ ; ; Top-level variable definition
829
866
(,(concat " (\\ (?:clojure.core/\\ )?\\ ("
830
867
(regexp-opt '(" def" " defonce" ))
831
868
; ; variable declarations
@@ -835,7 +872,6 @@ any number of matches of `clojure--sym-forbidden-rest-chars'."))
835
872
; ; Possibly type or metadata
836
873
" \\ (?:#?^\\ (?:{[^}]*}\\ |\\ sw+\\ )[ \r\n\t ]*\\ )*"
837
874
" \\ (\\ sw+\\ )?" )
838
- (1 font-lock-keyword-face )
839
875
(2 font-lock-variable-name-face nil t ))
840
876
; ; Type definition
841
877
(,(concat " (\\ (?:clojure.core/\\ )?\\ ("
@@ -848,7 +884,6 @@ any number of matches of `clojure--sym-forbidden-rest-chars'."))
848
884
; ; Possibly type or metadata
849
885
" \\ (?:#?^\\ (?:{[^}]*}\\ |\\ sw+\\ )[ \r\n\t ]*\\ )*"
850
886
" \\ (\\ sw+\\ )?" )
851
- (1 font-lock-keyword-face )
852
887
(2 font-lock-type-face nil t ))
853
888
; ; Function definition (anything that starts with def and is not
854
889
; ; listed above)
@@ -861,21 +896,19 @@ any number of matches of `clojure--sym-forbidden-rest-chars'."))
861
896
; ; Possibly type or metadata
862
897
" \\ (?:#?^\\ (?:{[^}]*}\\ |\\ sw+\\ )[ \r\n\t ]*\\ )*"
863
898
(concat " \\ (" clojure--sym-regexp " \\ )?" ))
864
- (1 font-lock-keyword-face )
865
899
(2 font-lock-function-name-face nil t ))
866
900
; ; (fn name? args ...)
867
901
(,(concat " (\\ (?:clojure.core/\\ )?\\ (fn\\ )[ \t ]+"
868
902
; ; Possibly type
869
903
" \\ (?:#?^\\ sw+[ \t ]*\\ )?"
870
904
; ; Possibly name
871
905
" \\ (\\ sw+\\ )?" )
872
- (1 font-lock-keyword-face )
873
906
(2 font-lock-function-name-face nil t ))
874
907
; ; Special forms
875
908
(,(concat
876
909
" ("
877
910
(regexp-opt
878
- '(" def " " do" " if" " let*" " var" " fn" " fn*" " loop*"
911
+ '(" do" " if" " let*" " var" " fn" " fn*" " loop*"
879
912
" recur" " throw" " try" " catch" " finally"
880
913
" set!" " new" " ."
881
914
" monitor-enter" " monitor-exit" " quote" ) t )
0 commit comments