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

    Enhance header line format handling in `ellama.el`
    
    Ensure that modifications to the `header-line-format` only occur when it is 
a
    list. This prevents errors when `header-line-format` is not a list, such as
    when magit set it to string.
---
 ellama.el | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/ellama.el b/ellama.el
index 6f26f2bbe9..6fdbc3ca6d 100644
--- a/ellama.el
+++ b/ellama.el
@@ -1157,7 +1157,8 @@ the context."
   (add-hook 'window-state-change-hook #'ellama-context-update-header-line)
   (if ellama-context-header-line-mode
       (ellama-context-update-header-line)
-    (setq header-line-format (delete '(:eval (ellama-context-line)) 
header-line-format))))
+    (when (listp header-line-format)
+      (setq header-line-format (delete '(:eval (ellama-context-line)) 
header-line-format)))))
 
 ;;;###autoload
 (define-globalized-minor-mode ellama-context-header-line-global-mode
@@ -1166,11 +1167,12 @@ the context."
 
 (defun ellama-context-update-header-line ()
   "Update and display context information in the header line."
-  (if (and ellama-context-header-line-mode
-          (or ellama-context-line-always-visible
-              ellama--global-context))
-      (add-to-list 'header-line-format '(:eval (ellama-context-line)) t)
-    (setq header-line-format (delete '(:eval (ellama-context-line)) 
header-line-format))))
+  (when (listp header-line-format)
+    (if (and ellama-context-header-line-mode
+            (or ellama-context-line-always-visible
+                ellama--global-context))
+       (add-to-list 'header-line-format '(:eval (ellama-context-line)) t)
+      (setq header-line-format (delete '(:eval (ellama-context-line)) 
header-line-format)))))
 
 ;;;###autoload
 (define-minor-mode ellama-context-mode-line-mode

Reply via email to