branch: externals/ellama commit 8281a9847b1a35df5433d93a8e7569bbe7ef1215 Merge: 3b8cb56940 0e4b720a4b Author: Sergey Kostyaev <s-kosty...@users.noreply.github.com> Commit: GitHub <nore...@github.com>
Merge pull request #335 from swapneils/c-c-chat-shortcut Add C-c C-c shortcut to org-mode chat buffers --- ellama.el | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ellama.el b/ellama.el index bc1e02d18e..ca420d9d7b 100644 --- a/ellama.el +++ b/ellama.el @@ -1721,6 +1721,14 @@ the full response text when the request completes (with BUFFER current)." (find-file-noselect (ellama--get-translation-file-name file-name))) (get-buffer-create (ellama-session-id session)))))) + ;; Add C-c C-c shortcut when the chat buffer is in org-mode + (with-current-buffer buffer + (when (and + (derived-mode-p 'org-mode) + ;; Not already part of the hook + (not (and (boundp 'org-ctrl-c-ctrl-c-hook) + (member #'ellama-chat-send-last-message org-ctrl-c-ctrl-c-hook)))) + (add-hook 'org-ctrl-c-ctrl-c-hook #'ellama-chat-send-last-message 10 t))) (if ellama-chat-translation-enabled (ellama--translate-interaction prompt translation-buffer buffer session) (display-buffer buffer (when ellama-chat-display-action-function