Skip to content

Commit d343e60

Browse files
committed
feat: extract fill text
1 parent f349d7d commit d343e60

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

jcs-poptip.el

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,15 +202,19 @@ forever delay. HEIGHT of the tooltip that will display."
202202
(msgu-silent (describe-symbol thing))
203203
(buffer-string)))))
204204

205+
(defun jcs-poptip--fill-text (text &optional column)
206+
"Fill TEXT with COLUMN size."
207+
(with-temp-buffer
208+
(let ((fill-column (or column (frame-width))))
209+
(insert text)
210+
(fill-region (point-min) (point-max))
211+
(buffer-string))))
212+
205213
(defun jcs-poptip--describe-it ()
206214
"Describe symbol at point."
207215
(when-let* (((derived-mode-p 'lisp-data-mode))
208216
(desc (jcs-poptip--describe-symbol-string))
209-
(desc (with-temp-buffer
210-
(let ((fill-column (frame-width)))
211-
(insert desc)
212-
(fill-region (point-min) (point-max))
213-
(buffer-string)))))
217+
(desc (jcs-poptip--fill-text desc)))
214218
(if (or (string-empty-p desc)
215219
(string= (string-trim desc) "[back]"))
216220
(error "[ERROR] No description at point")

0 commit comments

Comments
 (0)