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

    Add options to control reasoning display in ellama
    
    Added new customization variables `ellama-show-reasoning` and
    `ellama-reasoning-display-action-function` to control the display of 
reasoning.
    Updated `ellama.el` to use these new variables when displaying reasoning
    buffers.
---
 README.org |  2 ++
 ellama.el  | 16 +++++++++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/README.org b/README.org
index 865b783f51..2d5ecd3c78 100644
--- a/README.org
+++ b/README.org
@@ -477,6 +477,8 @@ argument generated text string.
 - ~ellama-community-prompts-file~: Path to the CSV file containing community 
prompts.
   This file is expected to be located inside an ~ellama~ subdirectory
   within your ~user-emacs-directory~.
+- ~ellama-show-reasoning~: Show reasoning in separate buffer if enabled. 
Enabled by default.
+- ~ellama-reasoning-display-action-function~: Display action function for 
reasoning.
 
 ** Minor modes
 
diff --git a/ellama.el b/ellama.el
index e8d4d0e0fd..2d008cf9a4 100644
--- a/ellama.el
+++ b/ellama.el
@@ -502,6 +502,16 @@ It should be a function with single argument generated 
text string."
   :group 'ellama
   :type 'function)
 
+(defcustom ellama-reasoning-display-action-function nil
+  "Display action function for reasoning."
+  :group 'ellama
+  :type 'function)
+
+(defcustom ellama-show-reasoning t
+  "Show reasoning in separate buffer if enabled."
+  :group 'ellama
+  :type 'boolean)
+
 (define-minor-mode ellama-session-mode
   "Minor mode for ellama session buffers."
   :interactive nil
@@ -1222,7 +1232,11 @@ REASONING-BUFFER is a buffer for reasoning."
            (progn
              (with-current-buffer reasoning-buffer
                (funcall insert-reasoning reasoning)
-               (display-buffer reasoning-buffer))
+               (when ellama-show-reasoning
+                 (display-buffer
+                  reasoning-buffer
+                  (when ellama-reasoning-display-action-function
+                    `((ignore . 
(,ellama-reasoning-display-action-function)))))))
              nil)))
        (when text
          (string-trim text)))))))

Reply via email to