branch: elpa/beancount
commit 695104d47e08050e3d35e3ae81515875e5f7dad9
Author: Daniele Nicolodi <dani...@grinta.net>
Commit: Daniele Nicolodi <dani...@grinta.net>

    beancount.el: Fix beancount-insert-account
---
 beancount.el | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/beancount.el b/beancount.el
index 3085e20171..cd7d009093 100644
--- a/beancount.el
+++ b/beancount.el
@@ -604,10 +604,13 @@ Uses ido niceness according to `beancount-use-ido'."
   (interactive
    (list
     (if beancount-use-ido
-        ;; `ido-completing-read' is too dumb to understand functional
-        ;; completion tables!
-        (ido-completing-read "Account: " beancount-accounts
-                             nil nil (thing-at-point 'word))
+        ;; `ido-completing-read' does not understand functional
+        ;; completion tables thus directly build a list of the
+        ;; accounts in the buffer
+        (let ((beancount-accounts
+               (sort (beancount-collect beancount-account-regexp 0) 
#'string<)))
+          (ido-completing-read "Account: " beancount-accounts
+                               nil nil (thing-at-point 'word)))
       (completing-read "Account: " #'beancount-account-completion-table
                        nil t (thing-at-point 'word)))))
   (let ((bounds (bounds-of-thing-at-point 'word)))

Reply via email to