File tree Expand file tree Collapse file tree 1 file changed +7
-12
lines changed Expand file tree Collapse file tree 1 file changed +7
-12
lines changed Original file line number Diff line number Diff line change 27
27
; ;; Code:
28
28
29
29
(require 'cl-lib )
30
+ (require 'seq )
30
31
(require 'shr )
31
32
(require 'subr-x )
32
33
@@ -140,20 +141,14 @@ Prioritize rendering as much as possible while staying within `cider-docstring-m
140
141
second-attempt
141
142
first-attempt)))
142
143
143
- (defun cider-docstring--trim (s &optional n )
144
- " Returns up to the first N lines of string S ,
144
+ (cl- defun cider-docstring--trim (string &optional (max-lines cider-docstring-max-lines) )
145
+ " Returns up to the first MAX-LINES lines of string STRING ,
145
146
adding \" ...\" if trimming was necessary.
146
147
147
- N defaults to `cider-docstring-max-lines' ."
148
- (when s
149
- (let* ((n (or n cider-docstring-max-lines))
150
- (lines (split-string s " \n " ))
151
- (lines-length (length lines))
152
- (selected-lines (cl-subseq lines 0 (min n lines-length)))
153
- (result (string-join selected-lines " \n " )))
154
- (if (> lines-length n)
155
- (concat result " ..." )
156
- result))))
148
+ MAX-LINES defaults to `cider-docstring-max-lines' ."
149
+ (let* ((lines (split-string string " \n " ))
150
+ (string (string-join (seq-take lines max-lines) " \n " )))
151
+ (concat string (when (> (length lines) max-lines) " ..." ))))
157
152
158
153
(defun cider-docstring--format (s )
159
154
" Performs formatting of S, cleaning up some common whitespace issues."
You can’t perform that action at this time.
0 commit comments