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

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

[nongnu] elpa/gptel 00abbf7597 081/273: gptel-transient: More visual fee


From: ELPA Syncer
Subject: [nongnu] elpa/gptel 00abbf7597 081/273: gptel-transient: More visual feedback
Date: Wed, 1 May 2024 10:01:48 -0400 (EDT)

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

    gptel-transient: More visual feedback
    
    * gptel.el (gptel): `gptel' only pops to the gptel buffer when
    called interactively.
    
    * gptel-transient.el: Pop up the gptel session buffer when the
    prompt is sent to it, but don't select it. Also message the user
    that the response has been redirected to the gptel session.
---
 gptel-transient.el | 17 ++++++++++++++---
 gptel.el           |  7 ++++---
 2 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/gptel-transient.el b/gptel-transient.el
index 773a58be30..1548325677 100644
--- a/gptel-transient.el
+++ b/gptel-transient.el
@@ -328,7 +328,9 @@ will get progressively longer!"
                                t))
                             (point))
                           (point))))))
-      (setq position (with-current-buffer buffer (point)))
+      (with-current-buffer buffer
+        (gptel--update-header-line " Waiting..." 'warning)
+        (setq position (point)))
       (setq output-to-other-buffer-p t))
      ((setq buffer-name
             (cl-some (lambda (s) (and (string-prefix-p "-e" s)
@@ -352,7 +354,9 @@ will get progressively longer!"
         (with-current-buffer buffer
           (goto-char (point-max))
           (insert reduced-prompt)
-          (setq position (point))))))
+          (setq position (point))
+          (when gptel-mode
+            (gptel--update-header-line " Waiting..." 'warning))))))
 
     (when in-place
       (setq prompt (gptel--create-prompt (point)))
@@ -375,7 +379,14 @@ will get progressively longer!"
      :position position
      :in-place (and in-place (not output-to-other-buffer-p))
      :stream stream
-     :callback callback)))
+     :callback callback)
+    (when output-to-other-buffer-p
+      (message (concat "Prompt sent to buffer: "
+                       (propertize buffer-name 'face 'help-key-binding)))
+      (display-buffer
+       buffer '((display-buffer-reuse-window
+                 display-buffer-pop-up-window)
+                (reusable-frames . visible))))))
 
 ;; ** Set system message
 (transient-define-suffix gptel--suffix-system-message ()
diff --git a/gptel.el b/gptel.el
index fc50b24370..ce239021c7 100644
--- a/gptel.el
+++ b/gptel.el
@@ -618,11 +618,12 @@ buffer created or switched to."
      (t (funcall gptel-default-mode)))
     (unless gptel-mode (gptel-mode 1))
     (if (bobp) (insert (or initial (gptel-prompt-string))))
-    (pop-to-buffer (current-buffer))
     (goto-char (point-max))
     (skip-chars-backward "\t\r\n")
-    (message "Send your query with %s!"
-             (substitute-command-keys "\\[gptel-send]"))
+    (when (called-interactively-p 'gptel)
+      (pop-to-buffer (current-buffer))
+      (message "Send your query with %s!"
+               (substitute-command-keys "\\[gptel-send]")))
     (current-buffer)))
 
 (defun gptel--convert-markdown->org (str)



reply via email to

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