branch: externals/ellama
commit b992c830e212cce32e49491effc9645f570712c3
Author: Sergey Kostyaev <[email protected]>
Commit: Sergey Kostyaev <[email protected]>
Improve ellama session display
Added checks to ensure `header-line-format` and `mode-line-format` are lists
before adding the session line. This prevents potential errors when they
are not
list types.
---
ellama.el | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/ellama.el b/ellama.el
index aebb55a00c..b1c3582e07 100644
--- a/ellama.el
+++ b/ellama.el
@@ -718,12 +718,13 @@ This filter contains only subset of markdown syntax to be
good enough."
(defun ellama-session-line ()
"Return current session id line."
- (propertize (format "ellama session: %s" ellama--current-session-id)
+ (propertize (format " ellama session: %s" ellama--current-session-id)
'face 'ellama-face))
(defun ellama-session-show-header-line ()
"Display session id in the header line."
- (add-to-list 'header-line-format '(:eval (ellama-session-line)) t))
+ (when (listp header-line-format)
+ (add-to-list 'header-line-format '(:eval (ellama-session-line)) t)))
(defun ellama-session-hide-header-line ()
"Hide session id from header line."
@@ -750,7 +751,8 @@ This filter contains only subset of markdown syntax to be
good enough."
(defun ellama-session-show-mode-line ()
"Display session id in the mode line."
- (add-to-list 'mode-line-format '(:eval (ellama-session-line)) t))
+ (when (listp mode-line-format)
+ (add-to-list 'mode-line-format '(:eval (ellama-session-line)) t)))
(defun ellama-session-hide-mode-line ()
"Hide session id from mode line."