gptel-transient: Show descriptions of directives
* gptel-transient.el (gptel-system-prompt--setup): (Tentative change) Show descriptions of directives next to the keys when picking a directive from the system-prompt menu.
This commit is contained in:
parent
7c2e342f35
commit
d6ef79f621
1 changed files with 16 additions and 5 deletions
|
@ -166,6 +166,7 @@ which see."
|
||||||
'gptel-system-prompt
|
'gptel-system-prompt
|
||||||
(cl-loop for (type . prompt) in gptel-directives
|
(cl-loop for (type . prompt) in gptel-directives
|
||||||
with taken
|
with taken
|
||||||
|
with width = (window-width)
|
||||||
for name = (symbol-name type)
|
for name = (symbol-name type)
|
||||||
for key =
|
for key =
|
||||||
(let ((idx 0) pos)
|
(let ((idx 0) pos)
|
||||||
|
@ -179,11 +180,21 @@ which see."
|
||||||
;; are treated as suffixes when invoking `gptel-system-prompt' directly,
|
;; are treated as suffixes when invoking `gptel-system-prompt' directly,
|
||||||
;; and infixes when going through `gptel-menu'.
|
;; and infixes when going through `gptel-menu'.
|
||||||
;; TODO: Raise an issue with Transient.
|
;; TODO: Raise an issue with Transient.
|
||||||
collect (list (key-description key) (capitalize name)
|
collect (list (key-description key)
|
||||||
`(lambda () (interactive)
|
(concat (capitalize name) " "
|
||||||
(message "Directive: %s" ,prompt)
|
(propertize " " 'display '(space :align-to 20))
|
||||||
(setq gptel--system-message ,prompt))
|
(propertize
|
||||||
:transient 'transient--do-return)
|
(concat
|
||||||
|
"("
|
||||||
|
(string-replace
|
||||||
|
"\n" " "
|
||||||
|
(truncate-string-to-width prompt (- width 30) nil nil t))
|
||||||
|
")")
|
||||||
|
'face 'shadow))
|
||||||
|
`(lambda () (interactive)
|
||||||
|
(message "Directive: %s" ,prompt)
|
||||||
|
(setq gptel--system-message ,prompt))
|
||||||
|
:transient 'transient--do-return)
|
||||||
into prompt-suffixes
|
into prompt-suffixes
|
||||||
finally return
|
finally return
|
||||||
(nconc
|
(nconc
|
||||||
|
|
Loading…
Add table
Reference in a new issue