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

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

[elpa] externals/ellama 1a2c428506 06/11: Add session remove


From: ELPA Syncer
Subject: [elpa] externals/ellama 1a2c428506 06/11: Add session remove
Date: Thu, 18 Jan 2024 15:57:53 -0500 (EST)

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

    Add session remove
---
 ellama.el | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/ellama.el b/ellama.el
index b188511727..5ca58203b7 100644
--- a/ellama.el
+++ b/ellama.el
@@ -429,6 +429,21 @@ PROMPT is a variable contains last prompt in this session."
     (kill-buffer session-buffer)
     (display-buffer buffer)))
 
+(defun ellama-session-remove ()
+  "Remove ellama session."
+  (interactive)
+  (let* ((id (completing-read
+             "Select session to remove: "
+             (hash-table-keys ellama--active-sessions)))
+        (buffer (ellama-get-session-buffer id))
+        (file (buffer-file-name buffer))
+        (session-file (ellama--get-session-file-name file)))
+    (with-current-buffer buffer
+      (ellama--session-deactivate)
+      (kill-buffer))
+    (delete-file file t)
+    (delete-file session-file t)))
+
 (defun ellama-stream (prompt &rest args)
   "Query ellama for PROMPT.
 ARGS contains keys for fine control.



reply via email to

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