Add gptel-chat-with-buffer function and keybinding
This commit introduces the gptel-chat-with-buffer function, allowing users to start a chat with the buffer content. It also updates keybindings, assigning "b" to the new function and moving gptel-select-backend to "B".
This commit is contained in:
parent
e63466ca1f
commit
a47f4e537d
@ -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-<return>" #'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))
|
||||
|
Loading…
Reference in New Issue
Block a user