branch: elpa/gptel
commit 04da0a42af7fd81be6bd004f311c710b5cf3111e
Author: Karthik Chikmagalur <[email protected]>
Commit: Karthik Chikmagalur <[email protected]>
gptel: Truncate function documentation to newline
* gptel.el (gptel--describe-directive): Return function
documentation only up to the first newline. Most of the following
documentation is usually irrelevant in the context that we show it
in gptel.
* gptel-rewrite.el (gptel-rewrite-menu): Prettify rewrite
directive display in the menu.
---
gptel-rewrite.el | 2 +-
gptel.el | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/gptel-rewrite.el b/gptel-rewrite.el
index 7a2aebd01a..97cb8e98cf 100644
--- a/gptel-rewrite.el
+++ b/gptel-rewrite.el
@@ -352,7 +352,7 @@ By default, gptel uses the directive associated with the
`rewrite'
[:description
(lambda ()
(gptel--describe-directive
- gptel--rewrite-directive (max (- (window-width) 14) 20) "⮐"))
+ gptel--rewrite-directive (max (- (window-width) 14) 20) " "))
[""
("s" "Set full directive" gptel--rewrite-directive-menu)
(gptel--infix-rewrite-extra)]]
diff --git a/gptel.el b/gptel.el
index 599d5b8929..3e91d91b47 100644
--- a/gptel.el
+++ b/gptel.el
@@ -1013,7 +1013,8 @@ replaced with REPLACEMENT."
(string-replace
"\n" (or replacement " ")
(truncate-string-to-width
- (or (documentation directive)
+ (or (and-let* ((doc (documentation directive)))
+ (substring doc nil (string-match-p "\n" doc)))
"[Dynamically generated; no preview available]")
width nil nil t))))
(list (and-let* ((from-template (car directive)))