diff --git a/emacs/.emacs.d/config/init-ai.el b/emacs/.emacs.d/config/init-ai.el index cc0526b..652d168 100644 --- a/emacs/.emacs.d/config/init-ai.el +++ b/emacs/.emacs.d/config/init-ai.el @@ -57,6 +57,17 @@ (gptel buffer nil initial interactivep)) (with-current-buffer buffer (setq-local gptel--system-message (alist-get 'org-mode gptel-directives)))) + (defun gptel-chat-with-buffer (&optional arg interactivep) + (interactive (list current-prefix-arg t)) + (let* ((name (format "*gptel: %s*"(buffer-name))) + (buffer (if arg + (generate-new-buffer name) + name))) + (gptel buffer nil (buffer-string) interactivep) + (with-current-buffer buffer + (goto-char (point-max)) + (newline) + (insert (gptel-prompt-prefix-string))))) :general ("C-c RET" #'gptel-send "C-c C-" #'gptel-menu) @@ -65,7 +76,8 @@ "o" #'gptel-org "s" #'gptel-send "m" #'gptel-menu - "b" #'gptel-select-backend + "b" #'gptel-chat-with-buffer + "B" #'gptel-select-backend "a" #'gptel-context-add "f" #'gptel-context-add-file "k" #'gptel-abort))