diff options
| author | Craig Jennings <c@cjennings.net> | 2025-10-12 11:47:26 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2025-10-12 11:47:26 -0500 |
| commit | 092304d9e0ccc37cc0ddaa9b136457e56a1cac20 (patch) | |
| tree | ea81999b8442246c978b364dd90e8c752af50db5 /modules/ledger-config.el | |
changing repositories
Diffstat (limited to 'modules/ledger-config.el')
| -rw-r--r-- | modules/ledger-config.el | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/modules/ledger-config.el b/modules/ledger-config.el new file mode 100644 index 00000000..c268fa36 --- /dev/null +++ b/modules/ledger-config.el @@ -0,0 +1,50 @@ +;;; ledger-config.el --- Ledger Configuration -*- lexical-binding: t; coding: utf-8; -*- +;; author Craig Jennings <c@cjennings.net> + +;;; Commentary: + +;; -------------------------------- Ledger Mode -------------------------------- +;; edit files in ledger format + +(use-package ledger-mode + :mode ("\\.dat\\'" + "\\.ledger\\'" + "\\.journal\\'") + :preface + (defun cj/ledger-save () + "Automatically clean the ledger buffer at each save." + (interactive) + (save-excursion + (when (buffer-modified-p) + (with-demoted-errors (ledger-mode-clean-buffer)) + (save-buffer)))) + :bind + (:map ledger-mode-map + ("C-x C-s" . cj/ledger-save)) + :custom + (ledger-clear-whole-transactions t) + (ledger-reconcile-default-commodity "$") + (ledger-report-use-header-line nil) + (ledger-reports + '(("bal" "%(binary) --strict -f %(ledger-file) bal") + ("bal this month" "%(binary) --strict -f %(ledger-file) bal -p %(month) -S amount") + ("bal this year" "%(binary) --strict -f %(ledger-file) bal -p 'this year'") + ("net worth" "%(binary) --strict -f %(ledger-file) bal Assets Liabilities") + ("account" "%(binary) --strict -f %(ledger-file) reg %(account)")))) + +;; ------------------------------ Flycheck Ledger ------------------------------ +;; syntax and unbalanced transaction linting + +(use-package flycheck-ledger + :after ledger-mode) + +;; ------------------------------- Company Ledger ------------------------------ +;; autocompletion for ledger + +(use-package company-ledger + :after (company ledger-mode) + :config + (add-to-list 'company-backends 'company-ledger)) + +(provide 'ledger-config) +;;; ledger-config.el ends here. |
