Skip to content

Commit

Permalink
Tweak docstring of cider-docstring--format and remove redundant comment
Browse files Browse the repository at this point in the history
  • Loading branch information
katomuso committed Jun 11, 2024
1 parent 698c0e4 commit 70a853f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions cider-docstring.el
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,13 @@ Prioritize rendering as much as possible while staying within `cider-docstring-m
(concat string (when (> (length lines) max-lines) "..."))))

(defun cider-docstring--format (string)
"Return a nicely formatted STRING to be displayed to the user."
;; As this is a literal docstring from the source code and
;; there are two spaces at the beginning of lines in docstrings,
;; we remove them to make it align nicely when it is displayed.
"Return a nicely formatted STRING to be displayed to the user.
We need to format the docstring before displaying it to the user because
it is obtained from the source code. For example, this means that it has
two spaces before each line used for indentation. While displaying the
docstring to the user, we usually want to control indentation and other
aspects of the presentation, so we need to format it beforehand."
(replace-regexp-in-string "\n " "\n" string))

(provide 'cider-docstring)
Expand Down

0 comments on commit 70a853f

Please sign in to comment.