branch: externals/ellama
commit 4340f71d75ddc39b1731f14310a7c4f5f8129dce
Author: Sergey Kostyaev <sskosty...@gmail.com>
Commit: Sergey Kostyaev <sskosty...@gmail.com>

    Refactor `ellama-context-mode` to be a derived mode
    
    Refactored `ellama-context-mode` to be a derived mode from 
`fundamental-mode`
    and added a mode-specific suffix "ellama-ctx". Removed the minor mode test 
as it
    is no longer applicable.
---
 ellama.el            | 6 ++++--
 tests/test-ellama.el | 8 --------
 2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/ellama.el b/ellama.el
index 3fab3069e6..6f26f2bbe9 100644
--- a/ellama.el
+++ b/ellama.el
@@ -1228,7 +1228,9 @@ the context."
   "d"       #'ellama-remove-context-element-at-point
   "RET"     #'ellama-preview-context-element-at-point)
 
-(define-minor-mode ellama-context-mode
+(define-derived-mode ellama-context-mode
+  fundamental-mode
+  "ellama-ctx"
   "Toggle Ellama Context mode."
   :keymap ellama-context-mode-map
   :group 'ellama)
@@ -1239,7 +1241,7 @@ the context."
          (inhibit-read-only t))
     (with-current-buffer buf
       (read-only-mode +1)
-      (ellama-context-mode +1)
+      (ellama-context-mode)
       (erase-buffer)
       (dolist (el ellama--global-context)
         (insert (ellama-context-element-display el))
diff --git a/tests/test-ellama.el b/tests/test-ellama.el
index 6b47022191..6f695afe0c 100644
--- a/tests/test-ellama.el
+++ b/tests/test-ellama.el
@@ -415,14 +415,6 @@ Snake case helps improve readability, especially in 
languages that are sensitive
           (ellama--fix-file-name "a/\\?%*:|\"<>.;=")
           "a_____________")))
 
-(ert-deftest ellama-context-minor-mode-test ()
-  (with-temp-buffer
-    (should-not ellama-context-mode)
-    (ellama-context-mode 1)
-    (should ellama-context-mode)
-    (ellama-context-mode -1)
-    (should-not ellama-context-mode)))
-
 (provide 'test-ellama)
 
 ;;; test-ellama.el ends here

Reply via email to