branch: externals/ellama commit 7d13c4c3a3729fd99ef8dd32f9d3b3a3433e34b8 Author: Sergey Kostyaev <sskosty...@gmail.com> Commit: Sergey Kostyaev <sskosty...@gmail.com>
Set default directory for new sessions Updated the code to set the `default-directory` of a new session buffer to `ellama-sessions-directory`. Additionally, modified the session save function to use `buffer-file-name` if no file name is associated with the session. Fix #295 --- ellama.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ellama.el b/ellama.el index 8832ec6d14..0f1c3e0014 100644 --- a/ellama.el +++ b/ellama.el @@ -848,6 +848,7 @@ If EPHEMERAL non nil new session will not be associated with any file." (setq ellama--current-session-id id) (puthash id buffer ellama--active-sessions) (with-current-buffer buffer + (setq default-directory ellama-sessions-directory) (funcall ellama-major-mode) (setq ellama--current-session session) (ellama-session-mode +1)) @@ -908,7 +909,7 @@ If EPHEMERAL non nil new session will not be associated with any file." "Save current ellama session." (when ellama--current-session (let* ((session ellama--current-session) - (file-name (ellama-session-file session)) + (file-name (or (ellama-session-file session) buffer-file-name)) (session-file-name (ellama--get-session-file-name file-name))) (with-temp-file session-file-name (insert (prin1-to-string session))))))