Skip to content

Commit

Permalink
Add gptel--get-prompt-from-region function
Browse files Browse the repository at this point in the history
Signed-off-by: Eval EXEC <[email protected]>
  • Loading branch information
eval-exec committed Aug 9, 2024
1 parent 73ec108 commit be20c81
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions gptel-transient.el
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,12 @@ Or in an extended conversation:
prompt (gptel--rewrite-message) history)))



(defun gptel--get-prompt-from-region()
"Get the prompt from the region."
(buffer-substring-no-properties
(region-beginning) (region-end)))

;; * Transient Suffixes

;; ** Suffix to send prompt
Expand Down Expand Up @@ -713,8 +719,7 @@ Or in an extended conversation:
(read-string
(format "Ask %s: " (gptel-backend-name gptel-backend))
(and (use-region-p)
(buffer-substring-no-properties
(region-beginning) (region-end)))))
(gptel--get-prompt-from-region))))
((member "y" args)
(unless (car-safe kill-ring)
(user-error "`kill-ring' is empty! Nothing to send"))
Expand Down

0 comments on commit be20c81

Please sign in to comment.