branch: externals/ellama
commit aaef7946c90668a147d98994df7b038124c73cf0
Merge: 5b29e4ab2b 92cdebd10f
Author: Sergey Kostyaev <s-kosty...@users.noreply.github.com>
Commit: GitHub <nore...@github.com>

    Merge pull request #252 from s-kostyaev/fix-always-visible-context
    
    Fix always visible context
---
 NEWS.org  | 6 ++++++
 ellama.el | 6 ++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/NEWS.org b/NEWS.org
index 54ff3bca5c..ffc8ff3a14 100644
--- a/NEWS.org
+++ b/NEWS.org
@@ -1,3 +1,9 @@
+* Version 1.4.4
+- Ensured that the buffer ~ellama--context-buffer~ is created if it does not
+  exist before attempting to update and show context to prevent errors related
+  to non-existent buffers.
+- Added calls to ~ellama-update-context-show~ in both header line and mode line
+  minor modes to ensure context is shown when these modes are toggled.
 * Version 1.4.3
 - Added fallback mechanism to use the first available Ollama chat model when no
   specific provider is defined for various ellama functions, ensuring that a
diff --git a/ellama.el b/ellama.el
index b51db7d737..43a8556e3f 100644
--- a/ellama.el
+++ b/ellama.el
@@ -6,7 +6,7 @@
 ;; URL: http://github.com/s-kostyaev/ellama
 ;; Keywords: help local tools
 ;; Package-Requires: ((emacs "28.1") (llm "0.22.0") (plz "0.8") (transient 
"0.7") (compat "29.1"))
-;; Version: 1.4.3
+;; Version: 1.4.4
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;; Created: 8th Oct 2023
 
@@ -1123,7 +1123,7 @@ the context."
   "Update and show context in posframe of header line."
   (declare-function posframe-show "ext:posframe")
   (declare-function posframe-hide "ext:posframe")
-  (with-current-buffer ellama--context-buffer
+  (with-current-buffer (get-buffer-create ellama--context-buffer)
     (erase-buffer)
     (if ellama--global-context
        (insert (format
@@ -1168,6 +1168,7 @@ the context."
 (define-minor-mode ellama-context-header-line-mode
   "Toggle Ellama Context header line mode."
   :group 'ellama
+  (ellama-update-context-show)
   (add-hook 'window-state-change-hook #'ellama-context-update-header-line)
   (if ellama-context-header-line-mode
       (ellama-context-update-header-line)
@@ -1192,6 +1193,7 @@ the context."
 (define-minor-mode ellama-context-mode-line-mode
   "Toggle Ellama Context mode line mode."
   :group 'ellama
+  (ellama-update-context-show)
   (add-hook 'window-state-change-hook #'ellama-context-update-mode-line)
   (if ellama-context-mode-line-mode
       (ellama-context-update-mode-line)

Reply via email to