branch: externals/ellama commit 2e09b2a8d64067274bc7e0ef6193726d115b92b1 Author: Sergey Kostyaev <sskosty...@gmail.com> Commit: Sergey Kostyaev <sskosty...@gmail.com>
Add functionality to set file name and save session Added a new function `ellama--set-file-name-and-save` to handle setting the buffer's file name based on the current session ID and saving the buffer. Modified `ellama-session-mode` to remap `save-buffer` to this new function, ensuring that sessions are saved with the appropriate file names in the designated directory. --- ellama.el | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ellama.el b/ellama.el index 0f1c3e0014..837e48da5c 100644 --- a/ellama.el +++ b/ellama.el @@ -457,9 +457,20 @@ It should be a function with single argument generated text string." "Show reasoning in separate buffer if enabled." :type 'boolean) +(defun ellama--set-file-name-and-save () + "Set buffer file name and save buffer." + (interactive) + (setq buffer-file-name + (file-name-concat + ellama-sessions-directory + (concat ellama--current-session-id + "." (ellama-get-session-file-extension)))) + (save-buffer)) + (define-minor-mode ellama-session-mode "Minor mode for ellama session buffers." :interactive nil + :keymap '(([remap save-buffer] . ellama--set-file-name-and-save)) (if ellama-session-mode (progn (add-hook 'after-save-hook 'ellama--save-session nil t)