From 70a853f70499ec8639b3c8547f984a30d7f6c166 Mon Sep 17 00:00:00 2001 From: Kato Muso Date: Mon, 10 Jun 2024 23:45:48 +0000 Subject: [PATCH] Tweak docstring of cider-docstring--format and remove redundant comment --- cider-docstring.el | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cider-docstring.el b/cider-docstring.el index 965ead993..dda6c3184 100644 --- a/cider-docstring.el +++ b/cider-docstring.el @@ -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)