gptel: Better handling of read-only bufs

* gptel.el (gptel--insert-response): Turn on visual-line-mode in
the response buffer that is created when the gptel buffer is
read-only.

* gptel-curl.el (gptel-curl--stream-insert-response): Ditto.
This commit is contained in:
Karthik Chikmagalur 2024-01-15 16:12:15 -08:00
parent 1752f1d589
commit 3fb064a763
2 changed files with 2 additions and 0 deletions

View file

@ -284,6 +284,7 @@ See `gptel--url-get-response' for details."
(message "Buffer is read only, displaying reply in buffer \"*ChatGPT response*\"") (message "Buffer is read only, displaying reply in buffer \"*ChatGPT response*\"")
(display-buffer (display-buffer
(with-current-buffer (get-buffer-create "*ChatGPT response*") (with-current-buffer (get-buffer-create "*ChatGPT response*")
(visual-line-mode 1)
(goto-char (point-max)) (goto-char (point-max))
(move-marker (plist-get proc-info :position) (point) (current-buffer)) (move-marker (plist-get proc-info :position) (point) (current-buffer))
(current-buffer)) (current-buffer))

View file

@ -889,6 +889,7 @@ See `gptel--url-get-response' for details."
(message "Buffer is read only, displaying reply in buffer \"*ChatGPT response*\"") (message "Buffer is read only, displaying reply in buffer \"*ChatGPT response*\"")
(display-buffer (display-buffer
(with-current-buffer (get-buffer-create "*ChatGPT response*") (with-current-buffer (get-buffer-create "*ChatGPT response*")
(visual-line-mode 1)
(goto-char (point-max)) (goto-char (point-max))
(move-marker start-marker (point) (current-buffer)) (move-marker start-marker (point) (current-buffer))
(current-buffer)) (current-buffer))