From 092304d9e0ccc37cc0ddaa9b136457e56a1cac20 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 12 Oct 2025 11:47:26 -0500 Subject: changing repositories --- modules/ledger-config.el | 50 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 modules/ledger-config.el (limited to 'modules/ledger-config.el') 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 + +;;; 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. -- cgit v1.2.3