From 0cfe08d45fb67f6ca9b876ed7c6de1803865f6a2 Mon Sep 17 00:00:00 2001 From: Mountain Man <43313373+MountainMan1312@users.noreply.github.com> Date: Sat, 16 Dec 2023 15:30:52 -0500 Subject: Add hledger --- init.el | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'init.el') diff --git a/init.el b/init.el index aa663de..a6c4cc3 100644 --- a/init.el +++ b/init.el @@ -1565,6 +1565,37 @@ delimit it to END. Start an unlimited search at (setq browse-url-browser-function 'browse-url-firefox) +;; --------------------------------- +;; Finance +;; ------- +;; Emacs is perfect for plaintext +;; accounting. +;; --------------------------------- + +(use-package hledger-mode + :straight t + :mode ("\\.journal\\'" "\\.hledger\\'") + :config + (setq hledger-jfile (expand-file-name "~/kb/self.fin.hledger") + hledger-currency-string "USD")) + +;; Completion for accounts +(defun mm/hledger-completion-accounts () + (when-let ((bounds (and (boundp 'hledger-accounts-cache) + (bounds-of-thing-at-point 'symbol)))) + (list (car bounds) (point) hledger-accounts-cache))) +(add-hook 'hledger-mode-hook 'mm/hledger-completion-accounts) + +(use-package flycheck-hledger + :straight t + :after (flycheck + hledger-mode) + :demand t + :config + (setq flycheck-hledger-strict t) + (dolist (check + '("orderless" "payees" "accounts" "ordereddates" "recentassertions" "commodities" "uniqueleafnames")) + (add-to-list 'flycheck-hledger-checks check))) ;; --------------------------------------------------------------------- -- cgit v1.2.3