@@ -314,7 +314,7 @@ Returns to the buffer in which the command was invoked."
314
314
(cider--deep-vector-to-list (read indent))))))
315
315
316
316
; ;; Dynamic font locking
317
- (defcustom cider-font-lock-dynamically '(macro core)
317
+ (defcustom cider-font-lock-dynamically '(macro core deprecated )
318
318
" Specifies how much dynamic font-locking CIDER should use.
319
319
Dynamic font-locking this refers to applying syntax highlighting to vars
320
320
defined in the currently active nREPL connection. This is done in addition
@@ -326,30 +326,45 @@ that should be font-locked:
326
326
`macro' (default): Any defined macro gets the `font-lock-builtin-face' .
327
327
`function' : Any defined function gets the `font-lock-function-face' .
328
328
`var' : Any non-local var gets the `font-lock-variable-face' .
329
+ `deprecated' (default): Any deprecated var gets the `cider-deprecated' face.
329
330
`core' (default): Any symbol from clojure.core (face depends on type).
330
331
331
332
The value can also be t, which means to font-lock as much as possible."
332
333
:type '(choice (set :tag " Fine-tune font-locking"
333
334
(const :tag " Any defined macro" macro)
334
335
(const :tag " Any defined function" function)
335
336
(const :tag " Any defined var" var)
337
+ (const :tag " Any defined deprecated" deprecated)
336
338
(const :tag " Any symbol from clojure.core" core))
337
339
(const :tag " Font-lock as much as possible" t ))
338
340
:group 'cider
339
341
:package-version '(cider . " 0.10.0" ))
340
342
343
+ (defface cider-deprecated
344
+ '((((background light )) :background " light goldenrod" )
345
+ (((background dark )) :background " #432" ))
346
+ " Faced used on depreacted vars"
347
+ :group 'cider )
348
+
349
+ (defconst cider-deprecated-properties
350
+ '(face cider-deprecated
351
+ help-echo " This var is deprecated. \\ [cider-doc] for version information." ))
352
+
341
353
(defun cider--compile-font-lock-keywords (symbols-plist core-plist )
342
354
" Return a list of font-lock rules for the symbols in SYMBOLS-PLIST."
343
355
(let ((cider-font-lock-dynamically (if (eq cider-font-lock-dynamically t )
344
- '(function var macro core)
356
+ '(function var macro core deprecated )
345
357
cider-font-lock-dynamically))
358
+ deprecated
346
359
macros functions vars instrumented)
347
360
(when (memq 'core cider-font-lock-dynamically)
348
361
(while core-plist
349
362
(let ((sym (pop core-plist))
350
363
(meta (pop core-plist)))
351
364
(when (nrepl-dict-get meta " cider-instrumented" )
352
365
(push sym instrumented))
366
+ (when (nrepl-dict-get meta " deprecated" )
367
+ (push sym deprecated))
353
368
(cond
354
369
((nrepl-dict-get meta " macro" )
355
370
(push sym macros))
@@ -362,6 +377,9 @@ The value can also be t, which means to font-lock as much as possible."
362
377
(meta (pop symbols-plist)))
363
378
(when (nrepl-dict-get meta " cider-instrumented" )
364
379
(push sym instrumented))
380
+ (when (and (nrepl-dict-get meta " deprecated" )
381
+ (memq 'deprecated cider-font-lock-dynamically))
382
+ (push sym deprecated))
365
383
(cond
366
384
((and (memq 'macro cider-font-lock-dynamically)
367
385
(nrepl-dict-get meta " macro" ))
@@ -380,6 +398,8 @@ The value can also be t, which means to font-lock as much as possible."
380
398
`((,(regexp-opt functions 'symbols ) 0 font-lock-function-name-face append )))
381
399
,@(when vars
382
400
`((,(regexp-opt vars 'symbols ) 0 font-lock-variable-name-face append )))
401
+ ,@(when deprecated
402
+ `((,(regexp-opt deprecated 'symbols ) 0 cider-deprecated-properties append )))
383
403
,@(when instrumented
384
404
`((,(regexp-opt instrumented 'symbols ) 0 'cider-instrumented-face append ))))))
385
405
0 commit comments