浏览代码

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

Simon Watson 1 年之前
父节点
当前提交
c735c81f61
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      emacs/elisp/openai.el

+ 3 - 0
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")