From 451f72e07d21beef30800a5ed6cacc7a6d737401 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 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/cider-docstring.el b/cider-docstring.el index 965ead993..65742169e 100644 --- a/cider-docstring.el +++ b/cider-docstring.el @@ -148,10 +148,14 @@ 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 usually has two spaces before each line used for indentation +\(see https://guide.clojure.style/#docstring-indentation). While displaying +the docstring to the user, we usually want to control indentation and +other aspects of the presentation, so we format it before displaying." (replace-regexp-in-string "\n " "\n" string)) (provide 'cider-docstring)