emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/ellama d7160ee661 19/25: Check for existing session fil


From: ELPA Syncer
Subject: [elpa] externals/ellama d7160ee661 19/25: Check for existing session file in directory
Date: Fri, 28 Mar 2025 15:58:57 -0400 (EDT)

branch: externals/ellama
commit d7160ee6616fadf3dd7ad52d7b0a7cb7b3daaf9b
Author: Sergey Kostyaev <sskostyaev@gmail.com>
Commit: Sergey Kostyaev <sskostyaev@gmail.com>

    Check for existing session file in directory
    
    Enhanced the function to ensure that a new session ID is generated not only 
if a
    buffer with the same name exists, but also if a file with the same name 
exists
    in the sessions directory. This prevents overwriting existing session files.
---
 ellama.el | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/ellama.el b/ellama.el
index 837e48da5c..58c954800a 100644
--- a/ellama.el
+++ b/ellama.el
@@ -838,9 +838,15 @@ If EPHEMERAL non nil new session will not be associated 
with any file."
   (let* ((name (ellama-generate-name provider 'ellama prompt))
         (count 1)
         (name-with-suffix (format "%s %d" name count))
-        (id (if (not (ellama-get-session-buffer name))
+        (id (if (and (not (ellama-get-session-buffer name))
+                     (not (file-exists-p (file-name-concat
+                                          ellama-sessions-directory
+                                          (concat name "." 
(ellama-get-session-file-extension))))))
                 name
-              (while (ellama-get-session-buffer name-with-suffix)
+              (while (or (ellama-get-session-buffer name-with-suffix)
+                         (file-exists-p (file-name-concat
+                                         ellama-sessions-directory
+                                         (concat name-with-suffix "." 
(ellama-get-session-file-extension)))))
                 (setq count (+ count 1))
                 (setq name-with-suffix (format "%s %d" name count)))
               name-with-suffix))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]