Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new format for forms-str and arglists-str #2014

Merged
merged 1 commit into from
Jun 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cider-apropos.el
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ the symbol found by the apropos search as argument."
(define-button-type 'apropos-special-form
'apropos-label "Special form"
'apropos-short-label "s"
'face 'apropos-misc-button
'face 'font-lock-keyword-face
'help-echo "mouse-2, RET: Display more help on this special form"
'follow-link t
'action (lambda (button)
Expand Down
26 changes: 8 additions & 18 deletions cider-doc.el
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down Expand Up @@ -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
Expand Down