summaryrefslogtreecommitdiff
path: root/cider-doc.el
diff options
context:
space:
mode:
authorJuan Monetta <jpmonettas@gmail.com>2018-01-11 18:46:46 -0300
committerBozhidar Batsov <bozhidar.batsov@gmail.com>2018-01-11 23:46:46 +0200
commitf4e6c59ce591a98c558b9584d8cd193693ec0687 (patch)
tree0f479d5965e7a90acc4db1b9446e732b4c2b447c /cider-doc.el
parent9371af24b41f5d024d459919de4c9b5b758f4ba1 (diff)
Render specs in cider-doc using `cider-browse-spec--pprint-indented` (#2154)
This also adds a button to jump to the spec browser straight from the doc buffer.
Diffstat (limited to 'cider-doc.el')
-rw-r--r--cider-doc.el21
1 files changed, 9 insertions, 12 deletions
diff --git a/cider-doc.el b/cider-doc.el
index aadd0dd3..7f7c2e97 100644
--- a/cider-doc.el
+++ b/cider-doc.el
@@ -36,6 +36,7 @@
(require 'org-table)
(require 'button)
(require 'easymenu)
+(require 'cider-browse-spec)
;;; Variables
@@ -461,18 +462,14 @@ Tables are marked to be ignored by line wrap."
(insert ".\n"))
(insert "\n")
(when spec
- (emit "Spec: " 'font-lock-function-name-face)
- (dolist (part spec)
- (let ((role (car part))
- (desc (cadr part)))
- (insert (format "%-4s: " role))
- (thread-first desc
- cider-sync-request:format-code
- cider-font-lock-as-clojure
- (split-string "\n")
- insert-rectangle))
- (insert "\n"))
- (insert "\n"))
+ (emit "Spec:" 'font-lock-function-name-face)
+ (insert (cider-browse-spec--pprint-indented spec))
+ (insert "\n\n")
+ (insert-text-button "Browse spec"
+ 'follow-link t
+ 'action (lambda (_)
+ (cider-browse-spec (format "%s/%s" ns name))))
+ (insert "\n\n"))
(if cider-docview-file
(progn
(insert (propertize (if class java-name clj-name)