emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/gptel f218388d4d 082/273: gptel-transient: Fix bug when se


From: ELPA Syncer
Subject: [nongnu] elpa/gptel f218388d4d 082/273: gptel-transient: Fix bug when sending in existing session
Date: Wed, 1 May 2024 10:01:48 -0400 (EDT)

branch: elpa/gptel
commit f218388d4dcd88aa339872c797f4805a66d10217
Author: Karthik Chikmagalur <karthikchikmagalur@gmail.com>
Commit: Karthik Chikmagalur <karthikchikmagalur@gmail.com>

    gptel-transient: Fix bug when sending in existing session
    
    * gptel-transient.el (gptel--suffix-send, gptel-menu): When
    reading input from the minibuffer and sending the output to an
    existing gptel session, only use the prompt read from the
    minibuffer. Reword the "Overwrite/Delete prompt" option.
---
 gptel-transient.el | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/gptel-transient.el b/gptel-transient.el
index 1548325677..167b870e42 100644
--- a/gptel-transient.el
+++ b/gptel-transient.el
@@ -69,7 +69,7 @@ Or is it the other way around?"
     (gptel--infix-model)]
    ["Prompt:"
     ("-r" "From minibuffer instead" "-r")
-    ("-i" "Overwrite/Delete prompt" "-i")
+    ("-i" "Replace/Delete prompt" "-i")
     "Response to:"
     ("-m" "Minibuffer instead" "-m")
     ("-n" "New session" "-n"
@@ -339,18 +339,19 @@ will get progressively longer!"
       (setq buffer (get-buffer buffer-name))
       (setq output-to-other-buffer-p t)
       (let ((reduced-prompt
-             (if (use-region-p)
-                 (buffer-substring-no-properties (region-beginning)
-                                                 (region-end))
-               (buffer-substring-no-properties
-                (save-excursion
-                  (text-property-search-backward
-                   'gptel 'response
-                   (when (get-char-property (max (point-min) (1- (point)))
-                                            'gptel)
-                     t))
-                  (point))
-                (point)))))
+             (or prompt
+                 (if (use-region-p)
+                     (buffer-substring-no-properties (region-beginning)
+                                                     (region-end))
+                   (buffer-substring-no-properties
+                    (save-excursion
+                      (text-property-search-backward
+                       'gptel 'response
+                       (when (get-char-property (max (point-min) (1- (point)))
+                                                'gptel)
+                         t))
+                      (point))
+                    (point))))))
         (with-current-buffer buffer
           (goto-char (point-max))
           (insert reduced-prompt)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]