Skip to content

Commit 27485f6

Browse files
committed
Use new format for forms-str and arglists-str
Depends on emacs-clojure/cider-nrepl#411. Using the new forms-str and arglists-str formats simplifies code for `cider-docview-render-info`.
1 parent 3d6b97b commit 27485f6

File tree

2 files changed

+9
-19
lines changed

2 files changed

+9
-19
lines changed

cider-apropos.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ the symbol found by the apropos search as argument."
5757
(define-button-type 'apropos-special-form
5858
'apropos-label "Special form"
5959
'apropos-short-label "s"
60-
'face 'apropos-misc-button
60+
'face 'font-lock-keyword-face
6161
'help-echo "mouse-2, RET: Display more help on this special form"
6262
'follow-link t
6363
'action (lambda (button)

cider-doc.el

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -396,8 +396,10 @@ Tables are marked to be ignored by line wrap."
396396
(depr (nrepl-dict-get info "deprecated"))
397397
(macro (nrepl-dict-get info "macro"))
398398
(special (nrepl-dict-get info "special-form"))
399-
(forms (nrepl-dict-get info "forms-str"))
400-
(args (nrepl-dict-get info "arglists-str"))
399+
(forms (when-let ((str (nrepl-dict-get info "forms-str")))
400+
(split-string str "\n")))
401+
(args (when-let ((str (nrepl-dict-get info "arglists-str")))
402+
(split-string str "\n")))
401403
(doc (or (nrepl-dict-get info "doc")
402404
"Not documented."))
403405
(url (nrepl-dict-get info "url"))
@@ -426,22 +428,10 @@ Tables are marked to be ignored by line wrap."
426428
(emit (concat " "(cider-font-lock-as 'java-mode iface)))))
427429
(when (or super ifaces)
428430
(insert "\n"))
429-
(when (or forms args)
430-
(insert " ")
431-
(save-excursion
432-
(emit (cider-font-lock-as-clojure
433-
;; All `defn's use ([...] [...]), but some special forms use
434-
;; (...). We only remove the parentheses on the former.
435-
(replace-regexp-in-string "\\`(\\(\\[.*\\]\\))\\'" "\\1"
436-
(or forms args)))))
437-
;; It normally doesn't happen, but it's technically conceivable for
438-
;; the args string to contain unbalanced sexps, so `ignore-errors'.
439-
(ignore-errors
440-
(forward-sexp 1)
441-
(while (not (looking-at "$"))
442-
(insert "\n")
443-
(forward-sexp 1)))
444-
(forward-line 1))
431+
(when-let ((forms (or forms args)))
432+
(dolist (form forms)
433+
(insert " ")
434+
(emit (cider-font-lock-as-clojure form))))
445435
(when (or special macro)
446436
(emit (if special "Special Form" "Macro") 'font-lock-variable-name-face))
447437
(when added

0 commit comments

Comments
 (0)