emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/cider 738f393ec1 1/8: Change the way cider-docstring--form


From: ELPA Syncer
Subject: [nongnu] elpa/cider 738f393ec1 1/8: Change the way cider-docstring--format performs formatting
Date: Tue, 11 Jun 2024 03:59:33 -0400 (EDT)

branch: elpa/cider
commit 738f393ec1264d7fbb269580964b7229cc7eb063
Author: Kato Muso <m@katomuso.io>
Commit: Bozhidar Batsov <bozhidar@batsov.dev>

    Change the way cider-docstring--format performs formatting
---
 cider-docstring.el | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/cider-docstring.el b/cider-docstring.el
index 007bb0a8b7..965ead9930 100644
--- a/cider-docstring.el
+++ b/cider-docstring.el
@@ -149,13 +149,10 @@ Prioritize rendering as much as possible while staying 
within `cider-docstring-m
 
 (defun cider-docstring--format (string)
   "Return a nicely formatted STRING to be displayed to the user."
-  (let* ((string (replace-regexp-in-string "\\.  " ".\n\n" string)) ;; improve 
the formatting of e.g. clojure.core/reduce
-         (string (mapconcat (lambda (line)
-                              ;; Remove spaces at the beginning of each line, 
as it is common in many clojure.core defns:
-                              (replace-regexp-in-string "\\`[ ]+" "" line))
-                            (split-string string "\n")
-                            "\n")))
-    string))
+  ;; 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.
+  (replace-regexp-in-string "\n  " "\n" string))
 
 (provide 'cider-docstring)
 ;;; cider-docstring.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]