之前记录 beancout,账户和交易都在一个文件里。随着记录越来越多,就进行了拆分,将账户按照类型,拆分到 account 目录下,例如 account/expense.beancount, account/income.beancount 等。
至于交易,则按照年份拆分为 2022.beancount。
今天记账,发现在 2022.beancount 中无法补全账户信息,因为账户的信息都拆分到别的目录去了,我也没有打开这些账户的文件。
请问,怎么实现不打开这些账户文件,还能够去补全账户信息呢?毕竟总不能每次记录的时候,都先把账户的文件全部打开到 buffer 里吧?
目前用的是 purcell的配置,了解到有 company-mode 用于补全,但好像需要存在于 buffer 中的文件? 也尝试过把整个 beancount 文件,用 etags 生成 TAGS,但好像没啥反应,不太清楚是不是操作不对。
你这不叫补全吧,应该叫数据库查询……
否则你的问题就像是“怎么编辑没打开的文件”。
And made the following change:
- Read the account names from the specified accounts files and provide it to the autocomplete function
1 个赞
看了一下,应该就是在这里加了一个 beancount-accounts-files
, 然后指定到 accounts 的目录,让 beancount 找到补全的文件?
(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 beancount-accounts-files) #'string<)))
(complete-with-action action beancount-accounts string pred)))