@@ -314,7 +314,7 @@ Returns to the buffer in which the command was invoked."
314314 (cider--deep-vector-to-list (read indent))))))
315315
316316; ;; Dynamic font locking
317- (defcustom cider-font-lock-dynamically '(macro core)
317+ (defcustom cider-font-lock-dynamically '(macro core deprecated )
318318 " Specifies how much dynamic font-locking CIDER should use.
319319Dynamic font-locking this refers to applying syntax highlighting to vars
320320defined in the currently active nREPL connection. This is done in addition
@@ -326,30 +326,45 @@ that should be font-locked:
326326 `macro' (default): Any defined macro gets the `font-lock-builtin-face' .
327327 `function' : Any defined function gets the `font-lock-function-face' .
328328 `var' : Any non-local var gets the `font-lock-variable-face' .
329+ `deprecated' (default): Any deprecated var gets the `cider-deprecated' face.
329330 `core' (default): Any symbol from clojure.core (face depends on type).
330331
331332The value can also be t, which means to font-lock as much as possible."
332333 :type '(choice (set :tag " Fine-tune font-locking"
333334 (const :tag " Any defined macro" macro)
334335 (const :tag " Any defined function" function)
335336 (const :tag " Any defined var" var)
337+ (const :tag " Any defined deprecated" deprecated)
336338 (const :tag " Any symbol from clojure.core" core))
337339 (const :tag " Font-lock as much as possible" t ))
338340 :group 'cider
339341 :package-version '(cider . " 0.10.0" ))
340342
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+
341353(defun cider--compile-font-lock-keywords (symbols-plist core-plist )
342354 " Return a list of font-lock rules for the symbols in SYMBOLS-PLIST."
343355 (let ((cider-font-lock-dynamically (if (eq cider-font-lock-dynamically t )
344- '(function var macro core)
356+ '(function var macro core deprecated )
345357 cider-font-lock-dynamically))
358+ deprecated
346359 macros functions vars instrumented)
347360 (when (memq 'core cider-font-lock-dynamically)
348361 (while core-plist
349362 (let ((sym (pop core-plist))
350363 (meta (pop core-plist)))
351364 (when (nrepl-dict-get meta " cider-instrumented" )
352365 (push sym instrumented))
366+ (when (nrepl-dict-get meta " deprecated" )
367+ (push sym deprecated))
353368 (cond
354369 ((nrepl-dict-get meta " macro" )
355370 (push sym macros))
@@ -362,6 +377,9 @@ The value can also be t, which means to font-lock as much as possible."
362377 (meta (pop symbols-plist)))
363378 (when (nrepl-dict-get meta " cider-instrumented" )
364379 (push sym instrumented))
380+ (when (and (nrepl-dict-get meta " deprecated" )
381+ (memq 'deprecated cider-font-lock-dynamically))
382+ (push sym deprecated))
365383 (cond
366384 ((and (memq 'macro cider-font-lock-dynamically)
367385 (nrepl-dict-get meta " macro" ))
@@ -380,6 +398,8 @@ The value can also be t, which means to font-lock as much as possible."
380398 `((,(regexp-opt functions 'symbols ) 0 font-lock-function-name-face append )))
381399 ,@(when vars
382400 `((,(regexp-opt vars 'symbols ) 0 font-lock-variable-name-face append )))
401+ ,@(when deprecated
402+ `((,(regexp-opt deprecated 'symbols ) 0 cider-deprecated-properties append )))
383403 ,@(when instrumented
384404 `((,(regexp-opt instrumented 'symbols ) 0 'cider-instrumented-face append ))))))
385405
0 commit comments