2021-04-13 20:09:08 -04:00
|
|
|
;;; lang/beancount/config.el -*- lexical-binding: t; -*-
|
|
|
|
|
2021-04-15 14:15:42 -04:00
|
|
|
(use-package! beancount
|
2021-09-30 01:29:46 +02:00
|
|
|
:hook (beancount-mode . outline-minor-mode)
|
2023-09-14 00:03:55 +01:00
|
|
|
:init
|
|
|
|
(after! nerd-icons
|
|
|
|
(add-to-list 'nerd-icons-extension-icon-alist
|
|
|
|
'("beancount" nerd-icons-faicon "nf-fa-money" :face nerd-icons-lblue))
|
|
|
|
(add-to-list 'nerd-icons-mode-icon-alist
|
|
|
|
'(beancount-mode nerd-icons-faicon "nf-fa-money" :face nerd-icons-lblue)))
|
|
|
|
|
2021-04-13 20:09:08 -04:00
|
|
|
:config
|
2021-09-30 01:29:46 +02:00
|
|
|
(setq beancount-electric-currency t)
|
|
|
|
|
2022-08-12 20:29:19 +02:00
|
|
|
(when (modulep! +lsp)
|
2022-03-24 02:19:52 +01:00
|
|
|
(add-hook 'beancount-mode-local-vars-hook #'lsp! 'append))
|
2021-04-13 20:09:08 -04:00
|
|
|
|
2024-07-18 20:56:10 -04:00
|
|
|
;; HACK: The intro message changed in newer versions of Fava, plus, the output
|
|
|
|
;; could contain ANSI codes, causing the `beancount-fava' command to not
|
|
|
|
;; open the server in the browser after the server has started.
|
2024-08-15 23:18:47 -04:00
|
|
|
;; REVIEW: PR this upstream!
|
2024-07-18 20:56:10 -04:00
|
|
|
(defadvice! +beancount--open-in-browser-after-starting-fix-a (_process output)
|
|
|
|
:override #'beancount--fava-filter
|
|
|
|
(save-match-data
|
|
|
|
(let ((output (ansi-color-filter-apply output)))
|
|
|
|
(when-let ((url (string-match "\\(?:Starting\\|Running\\) Fava on \\(http://.+:[0-9]+\\)\n" output)))
|
|
|
|
(browse-url (match-string 1 output))))))
|
|
|
|
|
2021-04-13 20:09:08 -04:00
|
|
|
(map! :map beancount-mode-map
|
2021-04-15 14:15:42 -04:00
|
|
|
"TAB" (cmds! (and outline-minor-mode (outline-on-heading-p))
|
|
|
|
#'beancount-outline-cycle
|
|
|
|
#'indent-according-to-mode)
|
2023-02-25 20:45:15 -05:00
|
|
|
:m "[[" #'+beancount/previous-transaction
|
|
|
|
:m "]]" #'+beancount/next-transaction
|
2021-04-13 20:09:08 -04:00
|
|
|
:localleader
|
|
|
|
"b" #'+beancount/balance
|
|
|
|
"c" #'beancount-check
|
2023-09-20 20:18:53 +02:00
|
|
|
"s" #'+beancount/occur
|
2021-04-13 20:09:08 -04:00
|
|
|
"l" #'beancount-linked
|
|
|
|
"q" #'beancount-query
|
|
|
|
"x" #'beancount-context
|
|
|
|
(:prefix ("i" . "insert")
|
2022-02-09 14:54:49 +01:00
|
|
|
"c" #'+beancount/clone-transaction
|
|
|
|
"C" #'+beancount/clone-this-transaction
|
2021-04-13 20:09:08 -04:00
|
|
|
"a" #'beancount-insert-account
|
|
|
|
"p" #'beancount-insert-prices
|
2021-09-30 14:51:42 +02:00
|
|
|
"d" #'beancount-insert-date)))
|