c735c81f61d5eb6ac57cf00b6b132a70f1f71e48
commit c735c81f61d5eb6ac57cf00b6b132a70f1f71e48
Author: Simon Watson <spw01@protonmail.com>
Date: Mon Mar 20 15:22:41 2023 -0400

Split buffer and display output when run if buffer not already open

diff --git a/emacs/elisp/openai.el b/emacs/elisp/openai.el
index bf1e779..54dd8e0 100644
--- a/emacs/elisp/openai.el
+++ b/emacs/elisp/openai.el
@@ -24,6 +24,9 @@
:parser 'json-read
:complete (cl-function (lambda (&key data &allow-other-keys)
(with-current-buffer openai-response-buffer
+ (when (not (get-buffer-window (buffer-name openai-response-buffer)))
+ (let ((window (split-window)))
+ (set-window-buffer window openai-response-buffer)))
(goto-char (point-max))
(insert (format ">>> %s -- Response: %s"
(format-time-string "%Y-%m-%d %H:%M:%S")