Skip to content

Commit 61a615d

Browse files
committed
Refactor cider-docstring--format
1 parent 873cbdd commit 61a615d

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

cider-docstring.el

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -147,17 +147,15 @@ Prioritize rendering as much as possible while staying within `cider-docstring-m
147147
(string (string-join (seq-take lines max-lines) "\n")))
148148
(concat string (when (> (length lines) max-lines) "..."))))
149149

150-
(defun cider-docstring--format (s)
151-
"Performs formatting of S, cleaning up some common whitespace issues."
152-
(when s
153-
(let* ((s (replace-regexp-in-string "\\. " ".\n\n" s)) ;; improve the formatting of e.g. clojure.core/reduce
154-
(lines (split-string s "\n"))
155-
(result (mapconcat (lambda (f)
156-
;; Remove spaces at the beginning of each line, as it is common in many clojure.core defns:
157-
(replace-regexp-in-string "\\`[ ]+" "" f))
158-
lines
159-
"\n")))
160-
result)))
150+
(defun cider-docstring--format (string)
151+
"Performs formatting of STRING, cleaning up some common whitespace issues."
152+
(let* ((string (replace-regexp-in-string "\\. " ".\n\n" string)) ;; improve the formatting of e.g. clojure.core/reduce
153+
(string (mapconcat (lambda (line)
154+
;; Remove spaces at the beginning of each line, as it is common in many clojure.core defns:
155+
(replace-regexp-in-string "\\`[ ]+" "" line))
156+
(split-string string "\n")
157+
"\n")))
158+
string))
161159

162160
(provide 'cider-docstring)
163161
;;; cider-docstring.el ends here

0 commit comments

Comments
 (0)