module-ledger.el (2582B)
1 ;;; module-ledger.el 2 3 ;; Author: Mark Feller <mark.feller@member.fsf.org> 4 5 ;; This file is not part of GNU Emacs. 6 7 ;; This file is free software; you can redistribute it and/or modify 8 ;; it under the terms of the GNU General Public License as published by 9 ;; the Free Software Foundation; either version 3, or (at your option) 10 ;; any later version. 11 12 ;; This file is distributed in the hope that it will be useful, 13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 ;; GNU General Public License for more details. 16 17 ;; You should have received a copy of the GNU General Public License 18 ;; along with this file. If not, see <http://www.gnu.org/licenses/>. 19 20 ;;; Commentary: 21 22 ;;; Code: 23 24 (defun mjf/ledger-report (name command) 25 `(,name ,(concat "%(binary) -f %(ledger-file) " command))) 26 27 (defun mjf/ledger-reports (lst) 28 (mapcar (lambda (x) 29 (mjf/ledger-report (car x) (cadr x))) lst)) 30 31 (use-package ledger-mode 32 :mode "\\.ledger\\'" 33 :config 34 (add-hook 'ledger-report-mode-hook 'disable-line-numbers) 35 (add-hook 'ledger-report-mode-hook 'evil-emacs-state) 36 37 (setq ledger-post-amount-alignment-column 62) 38 (setq ledger-report-auto-refresh nil) 39 (setq ledger-reports 40 (mjf/ledger-reports 41 '(("bal" "bal -V") 42 ("reg" "reg") 43 ("stats" "stats") 44 ("payee" "reg @%(payee)") 45 ("account" "reg %(account)") 46 ("investments" "bal ^Assets:Investments") 47 ("net worth" "bal ^Assets ^Liabilities -V") 48 ("forecast" "reg ^Assets ^Liabilities --forecast 'd<[2030]'") 49 ("creditcard" "reg ^Liabilities:Credit --monthly") 50 ("budget" "reg ^Expenses -p 'last month' --monthly --budget") 51 ("budget year" "reg ^Expenses -p 'this year' --monthly --budget") 52 ("expenses" "bal ^Expenses and not Tax -p 'this month'") 53 ("expenses monthly" "reg ^Expenses and not Tax -S T -p 'this year' --monthly --collapse") 54 ("expenses month" "bal ^Expenses and not Tax --flat -S T -p 'last month'") 55 ("expenses year" "bal ^Expenses and not Tax --flat -S T -p 'this year'") 56 ("average" "reg -p 'this year' --monthly --average not Tax and ^Expenses") 57 ("paystubs" "print Income:Salary"))))) 58 59 (use-package flycheck-ledger 60 :disabled 61 :after (flycheck-mode ledger-mode)) 62 63 (provide 'module-ledger) 64 65 ;;; module-ledger.el ends here