[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/helm e9777e926e 1/3: Truncate shortdoc when needed
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/helm e9777e926e 1/3: Truncate shortdoc when needed |
Date: |
Tue, 3 May 2022 02:58:36 -0400 (EDT) |
branch: elpa/helm
commit e9777e926e680b64da67e63b7219a02f1441c347
Author: Thierry Volpiatto <thievol@posteo.net>
Commit: Thierry Volpiatto <thievol@posteo.net>
Truncate shortdoc when needed
---
helm-elisp.el | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/helm-elisp.el b/helm-elisp.el
index 59814e4143..95d773aa95 100644
--- a/helm-elisp.el
+++ b/helm-elisp.el
@@ -406,9 +406,11 @@ the same time to variable and a function."
collect (cons (concat c spaces annot) c) into lst
finally return (sort lst #'helm-generic-sort-fn)))
-(defun helm-get-first-line-documentation (sym &optional name)
- "Return first line documentation of symbol SYM.
-If SYM is not documented, return \"Not documented\"."
+(cl-defun helm-get-first-line-documentation (sym &optional name (end-column
72))
+ "Return first line documentation of symbol SYM truncated at END-COLUMN.
+If SYM is not documented, return \"Not documented\".
+Argument NAME allows specifiying what function to use to display
+documentation when SYM name is the same for function and variable."
(let ((doc (cl-typecase sym
((and fboundp boundp)
(cond ((string= name "describe-function")
@@ -424,7 +426,9 @@ If SYM is not documented, return \"Not documented\"."
;; for CL-style functions.
(not (string-match-p "^\n\n" doc)))
;; Some commands specify key bindings in their first line.
- (substitute-command-keys (car (split-string doc "\n")))
+ (truncate-string-to-width
+ (substitute-command-keys (car (split-string doc "\n")))
+ end-column nil nil t)
"Not documented")))
;;; File completion.