branch: elpa/gptel
commit 40c34b071ec498f1fa2f1eb67945e734d7d76ab2
Author: Karthik Chikmagalur <[email protected]>
Commit: Karthik Chikmagalur <[email protected]>
gptel-request: Fix another regression with prompt end position
* gptel-request.el (gptel-request): Following 943f0eb9, fix
another regression with how the prompt end position is computed
when the prompt is null and there is no active region. (#1249)
Fundamentally, the POSITION argument of `gptel-request' is where
the response will be inserted, and it may be a marker in any
buffer, so the prompt end position cannot be computed from it.
---
gptel-request.el | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/gptel-request.el b/gptel-request.el
index 43bca09a34..d023d7989a 100644
--- a/gptel-request.el
+++ b/gptel-request.el
@@ -1837,8 +1837,8 @@ cases.
The INFO plist has (at least) the following keys:
:data - The request data included with the query
-:position - marker at the point the request was sent, unless
- POSITION is specified.
+:position - marker where the response will (nominally) be inserted.
+ Of course, the insertion is left to the CALLBACK.
:buffer - The buffer current when the request was sent,
unless BUFFER is specified.
:status - Short string describing the result of the request,
@@ -1965,8 +1965,8 @@ be used to rerun or continue the request at a later time."
(gptel--schema schema)
(prompt-buffer
(cond ;prompt from buffer or explicitly
supplied
- ((null prompt)
- (gptel--create-prompt-buffer start-marker))
+ ((null prompt) ;Send text up to end of word (for
evil-mode users)
+ (gptel--create-prompt-buffer (gptel--at-word-end (point))))
((stringp prompt)
(gptel--with-buffer-copy buffer nil nil
(insert prompt)