branch: elpa/beancount commit 0f1e33067e5032382f425b5280169f50aa7dd497 Author: Dave Churchill <d...@ninthcuriosity.com> Commit: Martin Blais <bl...@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