summaryrefslogtreecommitdiff
path: root/cider-eldoc.el
diff options
context:
space:
mode:
authorBozhidar Batsov <bozhidar@batsov.com>2016-04-24 09:23:39 -0700
committerBozhidar Batsov <bozhidar@batsov.com>2016-04-24 09:23:39 -0700
commit6ae64216162b636c1c24e3ca5d322cb16fe7ef64 (patch)
tree8bd6a7e278de6470b0f63f0b0288315160e10089 /cider-eldoc.el
parent9991c35d14133739301dfe054a732a00c82a8ae2 (diff)
Allow the ns displayed by eldoc to be tailored via cider-eldoc-ns-function
Diffstat (limited to 'cider-eldoc.el')
-rw-r--r--cider-eldoc.el23
1 files changed, 18 insertions, 5 deletions
diff --git a/cider-eldoc.el b/cider-eldoc.el
index 32cb494f..29d540fd 100644
--- a/cider-eldoc.el
+++ b/cider-eldoc.el
@@ -49,15 +49,28 @@
(defvar-local cider-eldoc-last-symbol nil
"The eldoc information for the last symbol we checked.")
+(defcustom cider-eldoc-ns-function #'identity
+ "A function that returns a ns string to be used by eldoc.
+Takes one argument, a namespace name.
+For convenience, some functions are already provided for this purpose:
+`cider-abbreviate-ns', and `cider-last-ns-segment'."
+ :type '(choice (const :tag "Full namespace" identity)
+ (const :tag "Abbreviated namespace" cider-abbreviate-ns)
+ (const :tag "Last name in namespace" cider-last-ns-segment)
+ (function :tag "Custom function"))
+ :group 'cider
+ :package-version '(cider . "0.13.0"))
+
(defun cider-eldoc-format-thing (ns symbol thing)
"Format the eldoc subject defined by NS, SYMBOL and THING.
Normally NS and SYMBOL are used, but when empty we fallback
to THING (e.g. for Java methods)."
- (if (and ns (not (string= ns "")))
- (format "%s/%s"
- (cider-propertize ns 'ns)
- (cider-propertize symbol 'var))
- (cider-propertize thing 'var)))
+ (let ((ns (funcall cider-eldoc-ns-function ns)))
+ (if (and ns (not (string= ns "")))
+ (format "%s/%s"
+ (cider-propertize ns 'ns)
+ (cider-propertize symbol 'var))
+ (cider-propertize thing 'var))))
(defun cider-highlight-args (arglist pos)
"Format the the function ARGLIST for eldoc.