Skip to content

Commit

Permalink
Add kill current buffer function
Browse files Browse the repository at this point in the history
Added a new function `ellama-kill-current-buffer` and updated the keymap in
`ellama-blueprint-mode-map` to use this function instead of an anonymous lambda.
Also, updated the header line format to display the correct command names using
`substitute-command-keys`.
  • Loading branch information
s-kostyaev committed Feb 25, 2025
1 parent 6a27a8e commit 25911f9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions ellama.el
Original file line number Diff line number Diff line change
Expand Up @@ -1255,11 +1255,16 @@ the context."
(buffer-substring-no-properties (point-min) (point-max))
t))

(defun ellama-kill-current-buffer ()
"Kill current buffer."
(interactive)
(kill-buffer (current-buffer)))

(defvar-keymap ellama-blueprint-mode-map
:doc "Local keymap for Ellama blueprint mode buffers."
:parent global-map
"C-c C-c" #'ellama-send-buffer-to-new-chat
"C-c C-k" (lambda () (interactive) (kill-buffer (current-buffer))))
"C-c C-k" #'ellama-kill-current-buffer)

;;;###autoload
(define-derived-mode ellama-blueprint-mode
Expand All @@ -1269,7 +1274,8 @@ the context."
:keymap ellama-blueprint-mode-map
:group 'ellama
(setq header-line-format
"'C-c C-c' to send 'C-c C-k' to cancel"))
(substitute-command-keys
"`\\[ellama-send-buffer-to-new-chat]' to send `\\[ellama-kill-current-buffer]' to cancel")))

(defun ellama-update-context-buffer ()
"Update ellama context buffer."
Expand Down

0 comments on commit 25911f9

Please sign in to comment.