[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ellama 62364b5a4e 05/19: Add functionality to remove co
From: |
ELPA Syncer |
Subject: |
[elpa] externals/ellama 62364b5a4e 05/19: Add functionality to remove context elements by name |
Date: |
Sun, 23 Feb 2025 06:58:07 -0500 (EST) |
branch: externals/ellama
commit 62364b5a4eb85f15cf58cc143c2530ac967d4569
Author: Sergey Kostyaev <sskostyaev@gmail.com>
Commit: Sergey Kostyaev <sskostyaev@gmail.com>
Add functionality to remove context elements by name
Added a new function `ellama-context--element-remove-by-name` to remove all
context elements that match by name. Also added an interactive function
`ellama-context-element-remove-by-name` to prompt the user for the name of
the
element to remove and then call the internal function. Updated the transient
prefix menu to include a new "Delete element" option under the "Manage"
section.
---
ellama.el | 34 +++++++++++++++++++++++++++++-----
1 file changed, 29 insertions(+), 5 deletions(-)
diff --git a/ellama.el b/ellama.el
index 1201ccf045..3fab3069e6 100644
--- a/ellama.el
+++ b/ellama.el
@@ -1057,6 +1057,27 @@ If EPHEMERAL non nil new session will not be associated
with any file."
(erase-buffer))
(ellama-update-context-show))
+(defun ellama-context--element-remove-by-name (name)
+ "Remove all context element that matches by NAME."
+ (setq ellama--global-context
+ (cl-remove-if (lambda (el)
+ (string= name (ellama-context-element-display el)))
+ ellama--global-context)))
+
+;;;###autoload
+(defun ellama-context-element-remove-by-name ()
+ "Remove a context element by its name from the global context.
+This function prompts the user to select a context element from
+the list of unique elements currently present in the global
+context and removes it. After removal, it updates the display of
+the context."
+ (interactive)
+ (ellama-context--element-remove-by-name
+ (completing-read
+ "Remove context element: "
+ (seq-uniq (mapcar #'ellama-context-element-display
ellama--global-context))))
+ (ellama-update-context-show))
+
;; Context elements
(defclass ellama-context-element () ()
@@ -3075,18 +3096,21 @@ Call CALLBACK on result list of strings. ARGS contains
keys for fine control.
(transient-define-prefix ellama-transient-context-menu ()
"Context Commands."
- [["Context Commands"
- :description (lambda ()
- (ellama-update-context-buffer)
- (format "Current context:
+ ["Context Commands"
+ :description (lambda ()
+ (ellama-update-context-buffer)
+ (format "Current context:
%s" (with-current-buffer ellama-context-buffer
(buffer-substring (point-min) (point-max)))))
+ ["Add"
("b" "Add Buffer" ellama-context-add-buffer)
("d" "Add Directory" ellama-context-add-directory)
("f" "Add File" ellama-context-add-file)
("s" "Add Selection" ellama-context-add-selection)
- ("i" "Add Info Node" ellama-context-add-info-node)
+ ("i" "Add Info Node" ellama-context-add-info-node)]
+ ["Manage"
("m" "Manage context" ellama-manage-context)
+ ("D" "Delete element" ellama-context-element-remove-by-name)
("r" "Context reset" ellama-context-reset)]
["Quit" ("q" "Quit" transient-quit-one)]])
- [elpa] externals/ellama updated (1c52902d4d -> fb01a0cefe), ELPA Syncer, 2025/02/23
- [elpa] externals/ellama ee030435d4 02/19: Add option to always show context line in header or mode line, ELPA Syncer, 2025/02/23
- [elpa] externals/ellama bbac4df186 01/19: Reorganize transient menu, ELPA Syncer, 2025/02/23
- [elpa] externals/ellama d007a0f96f 04/19: Display current context in transient menu, ELPA Syncer, 2025/02/23
- [elpa] externals/ellama 25d34ce337 10/19: Fix community prompts, ELPA Syncer, 2025/02/23
- [elpa] externals/ellama 49593e60fa 12/19: Update variable prompt format, ELPA Syncer, 2025/02/23
- [elpa] externals/ellama f94002a405 15/19: Bump version, ELPA Syncer, 2025/02/23
- [elpa] externals/ellama 62364b5a4e 05/19: Add functionality to remove context elements by name,
ELPA Syncer <=
- [elpa] externals/ellama 4340f71d75 06/19: Refactor `ellama-context-mode` to be a derived mode, ELPA Syncer, 2025/02/23
- [elpa] externals/ellama ad88edf9ed 16/19: Merge pull request #238 from s-kostyaev/ux-improvements, ELPA Syncer, 2025/02/23
- [elpa] externals/ellama fb01a0cefe 19/19: Merge pull request #241 from s-kostyaev/improve-readme, ELPA Syncer, 2025/02/23
- [elpa] externals/ellama 7e0b688d7f 03/19: Enhance transient model loading description, ELPA Syncer, 2025/02/23
- [elpa] externals/ellama 071f49f831 08/19: Add community prompt collection feature, ELPA Syncer, 2025/02/23
- [elpa] externals/ellama 8e26db91c8 11/19: Update menu item, ELPA Syncer, 2025/02/23
- [elpa] externals/ellama a43bf8db31 13/19: Update ellama-community-prompts.el header, ELPA Syncer, 2025/02/23
- [elpa] externals/ellama 9d5b7046b3 14/19: Update package dependencies, ELPA Syncer, 2025/02/23
- [elpa] externals/ellama d9de354092 17/19: Add simple configuration example to readme, ELPA Syncer, 2025/02/23
- [elpa] externals/ellama 4bb90fcbd6 18/19: Update README for ellama provider description, ELPA Syncer, 2025/02/23