diff options
author | Tianxiang Xiong <tianxiang.xiong@gmail.com> | 2017-06-17 17:22:14 -0700 |
---|---|---|
committer | Bozhidar Batsov <bozhidar.batsov@gmail.com> | 2017-06-18 07:28:49 +0300 |
commit | b610bf1944ba8a8dd800ade66a4d06353bc5d7d0 (patch) | |
tree | e392bb0a8193e5c027fe5be2379a6b8aa41056db /cider-doc.el | |
parent | 3d6b97b271b44374bbd4a52ace5e1ff9387f55cf (diff) |
Use new format for forms-str and arglists-str
Depends on clojure-emacs/cider-nrepl#412.
Using the new forms-str and arglists-str formats simplifies code for
`cider-docview-render-info`.
Diffstat (limited to 'cider-doc.el')
-rw-r--r-- | cider-doc.el | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/cider-doc.el b/cider-doc.el index 29abd39a..2b34444c 100644 --- a/cider-doc.el +++ b/cider-doc.el @@ -396,8 +396,10 @@ Tables are marked to be ignored by line wrap." (depr (nrepl-dict-get info "deprecated")) (macro (nrepl-dict-get info "macro")) (special (nrepl-dict-get info "special-form")) - (forms (nrepl-dict-get info "forms-str")) - (args (nrepl-dict-get info "arglists-str")) + (forms (when-let ((str (nrepl-dict-get info "forms-str"))) + (split-string str "\n"))) + (args (when-let ((str (nrepl-dict-get info "arglists-str"))) + (split-string str "\n"))) (doc (or (nrepl-dict-get info "doc") "Not documented.")) (url (nrepl-dict-get info "url")) @@ -426,22 +428,10 @@ Tables are marked to be ignored by line wrap." (emit (concat " "(cider-font-lock-as 'java-mode iface))))) (when (or super ifaces) (insert "\n")) - (when (or forms args) - (insert " ") - (save-excursion - (emit (cider-font-lock-as-clojure - ;; All `defn's use ([...] [...]), but some special forms use - ;; (...). We only remove the parentheses on the former. - (replace-regexp-in-string "\\`(\\(\\[.*\\]\\))\\'" "\\1" - (or forms args))))) - ;; It normally doesn't happen, but it's technically conceivable for - ;; the args string to contain unbalanced sexps, so `ignore-errors'. - (ignore-errors - (forward-sexp 1) - (while (not (looking-at "$")) - (insert "\n") - (forward-sexp 1))) - (forward-line 1)) + (when-let ((forms (or forms args))) + (dolist (form forms) + (insert " ") + (emit (cider-font-lock-as-clojure form)))) (when (or special macro) (emit (if special "Special Form" "Macro") 'font-lock-variable-name-face)) (when added |