emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/beancount 0f1e33067e 100/103: Fix a bug where `beancount-a


From: ELPA Syncer
Subject: [nongnu] elpa/beancount 0f1e33067e 100/103: Fix a bug where `beancount-accounts` was read from the minibuffer
Date: Mon, 29 Apr 2024 15:59:49 -0400 (EDT)

branch: elpa/beancount
commit 0f1e33067e5032382f425b5280169f50aa7dd497
Author: Dave Churchill <dave@ninthcuriosity.com>
Commit: Martin Blais <blais@furius.ca>

    Fix a bug where `beancount-accounts` was read from the minibuffer
    
    Based on `completion-table-dynamic`, this sets the current buffer to
    the beancount buffer when doing completion in the minibuffer so the
    buffer-local `beancount-accounts` can be read.
---
 beancount.el | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/beancount.el b/beancount.el
index b6b89df717..b94f7cfab5 100644
--- a/beancount.el
+++ b/beancount.el
@@ -573,10 +573,13 @@ With an argument move to the previous non cleared 
transaction."
 
 (defun beancount-account-completion-table (string pred action)
   (if (eq action 'metadata) '(metadata (category . beancount-account))
-    (if (null beancount-accounts)
-        (setq beancount-accounts
-              (sort (beancount-collect beancount-account-regexp 0) #'string<)))
-    (complete-with-action action beancount-accounts string pred)))
+    (with-current-buffer (let ((win (minibuffer-selected-window)))
+                           (if (window-live-p win) (window-buffer win)
+                             (current-buffer)))
+      (if (null beancount-accounts)
+          (setq beancount-accounts
+               (sort (beancount-collect beancount-account-regexp 0) 
#'string<)))
+      (complete-with-action action beancount-accounts string pred))))
 
 ;; Default to substring completion for beancount accounts.
 (defconst beancount--completion-overrides



reply via email to

[Prev in Thread] Current Thread [Next in Thread]