Skip to content

Commit 4d915c3

Browse files
committed
Remove read from cider-browse-ns--first-doc-line
1 parent af2ec9c commit 4d915c3

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

cider-browse-ns.el

+4-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ If the first line of the DOC string contains multiple sentences, only
120120
the first sentence is returned. If the DOC string is nil, a Not documented
121121
string is returned."
122122
(if doc
123-
(let* ((split-newline (split-string (read doc) "\n"))
123+
(let* ((split-newline (split-string doc "\n"))
124124
(first-line (car split-newline)))
125125
(cond
126126
((string-match "\\. " first-line) (substring first-line 0 (match-end 0)))
@@ -135,6 +135,9 @@ Each item consists of a ns-var and the first line of its docstring."
135135
(propertized-ns-vars (nrepl-dict-map #'cider-browse-ns--properties ns-vars-with-meta)))
136136
(mapcar (lambda (ns-var)
137137
(let* ((doc (nrepl-dict-get-in ns-vars-with-meta (list ns-var "doc")))
138+
;; to avoid (read nil)
139+
;; it prompts the user for a Lisp expression
140+
(doc (when doc (read doc)))
138141
(first-doc-line (cider-browse-ns--first-doc-line doc)))
139142
(concat ns-var " " (propertize first-doc-line 'font-lock-face 'font-lock-doc-face))))
140143
propertized-ns-vars)))

test/cider-browse-ns-tests.el

+6-6
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,13 @@
6767
:to-equal "Not documented."))
6868

6969
(it "returns the first line of the doc string"
70-
(expect (cider-browse-ns--first-doc-line "\"True if s is nil, empty, or contains only whitespace.\"")
71-
:to-equal "True if s is nil, empty, or contains only whitespace."))
70+
(expect (cider-browse-ns--first-doc-line "True if s is nil, empty, or contains only whitespace.")
71+
:to-equal "True if s is nil, empty, or contains only whitespace."))
7272

7373
(it "returns the first sentence of the doc string if the first line contains multiple sentences"
74-
(expect (cider-browse-ns--first-doc-line "\"First sentence. Second sentence.\"")
75-
:to-equal "First sentence. "))
74+
(expect (cider-browse-ns--first-doc-line "First sentence. Second sentence.")
75+
:to-equal "First sentence. "))
7676

7777
(it "returns the first line of the doc string if the first sentence spans multiple lines"
78-
(expect (cider-browse-ns--first-doc-line "\"True if s is nil, empty, or\n contains only whitespace.\"")
79-
:to-equal "True if s is nil, empty, or...")))
78+
(expect (cider-browse-ns--first-doc-line "True if s is nil, empty, or\n contains only whitespace.")
79+
:to-equal "True if s is nil, empty, or...")))

0 commit comments

Comments
 (0)