summaryrefslogtreecommitdiff
path: root/cider-browse-ns.el
diff options
context:
space:
mode:
authorBozhidar Batsov <bozhidar@batsov.com>2016-02-13 10:31:31 +0200
committerBozhidar Batsov <bozhidar@batsov.com>2016-02-13 10:31:31 +0200
commit806949514c67eac909a1421be7a80490e18d1ec7 (patch)
tree3030da211364fe33016d09c7f7a553a30ccdc465 /cider-browse-ns.el
parente957eb5d56397767a90d8bf6a531511a26596b5c (diff)
Make the ns browser a bit more colourful
This simple solution doesn't font-lock precisely the different type of vars. We'll need to use the var type info to do this properly.
Diffstat (limited to 'cider-browse-ns.el')
-rw-r--r--cider-browse-ns.el18
1 files changed, 13 insertions, 5 deletions
diff --git a/cider-browse-ns.el b/cider-browse-ns.el
index a76ed3f1..17639a9f 100644
--- a/cider-browse-ns.el
+++ b/cider-browse-ns.el
@@ -69,12 +69,20 @@
(setq-local truncate-lines t)
(setq-local cider-browse-ns-current-ns nil))
+(defun cider-browse-ns--text-face (text)
+ "Match TEXT with a face."
+ (cond
+ ((string-match-p "\\." text) 'font-lock-type-face)
+ ((string-match-p "\\`*" text) 'font-lock-variable-name-face)
+ (t 'font-lock-function-name-face)))
+
(defun cider-browse-ns--properties (text)
- "Decorate TEXT with a clickable keymap and function face."
- (propertize text
- 'font-lock-face 'font-lock-function-name-face
- 'mouse-face 'highlight
- 'keymap cider-browse-ns-mouse-map))
+ "Decorate TEXT with a clickable keymap and a face."
+ (let ((face (cider-browse-ns--text-face text)))
+ (propertize text
+ 'font-lock-face face
+ 'mouse-face 'highlight
+ 'keymap cider-browse-ns-mouse-map)))
(defun cider-browse-ns--list (buffer title items &optional ns noerase)
"Reset contents of BUFFER.