Skip to content

Commit e32df61

Browse files
committed
[#2663] Implement displaying ClojureDocs data in an Emacs buffer
1 parent 27c2456 commit e32df61

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

cider-clojuredocs.el

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,30 @@ opposite of what that option dictates."
9494
(defun cider-clojuredocs--content (dict)
9595
"Generate a nice string from DICT."
9696
(with-temp-buffer
97-
(insert "= " (nrepl-dict-get dict "ns") "/" (nrepl-dict-get dict "name") "\n")
98-
(insert "== See Also\n")
99-
(insert "== Examples\n")
100-
(insert "== Notes\n")
97+
(insert "= " (nrepl-dict-get dict "ns") "/" (nrepl-dict-get dict "name") "\n\n")
98+
(let ((arglists (nrepl-dict-get dict "arglists")))
99+
(dolist (arglist arglists)
100+
(insert (format " [%s]\n" arglist)))
101+
(insert "\n")
102+
(insert (nrepl-dict-get dict "doc"))
103+
(insert "\n"))
104+
(insert "\n== See Also\n\n")
105+
(if-let ((see-alsos (nrepl-dict-get dict "see-alsos")))
106+
(dolist (see-also see-alsos)
107+
(insert (format "* %s\n" see-also)))
108+
(insert "Not available\n"))
109+
(insert "\n== Examples\n\n")
110+
(if-let ((examples (nrepl-dict-get dict "examples")))
111+
(dolist (example examples)
112+
(insert (cider-font-lock-as-clojure example))
113+
(insert "\n-------------------------------------------------\n"))
114+
(insert "Not available\n"))
115+
(insert "\n== Notes\n\n")
116+
(if-let ((notes (nrepl-dict-get dict "notes")))
117+
(dolist (note notes)
118+
(insert note)
119+
(insert "\n-------------------------------------------------\n"))
120+
(insert "Not available\n"))
101121
(buffer-string)))
102122

103123
(defun cider-clojuredocs-lookup (symbol)

0 commit comments

Comments
 (0)