;;; ledger-settings.el --- ledger settings  -*- lexical-binding: t -*-

;;; Commentary:
;; https://github.com/ledger/ledger-mode

;; Requirements:
;;   programs
;;     ledger https://www.ledger-cli.org/download.html
;;   Emacs packages
;;     ledger-mode ;; https://melpa.org/#/ledger-mode
;;       org
;;     flycheck-ledger ;; https://melpa.org/#/flycheck-ledger
;;     company-ledger ;; https://melpa.org/#/company-ledger

;;; Code:
(use-package ledger-mode
  :delight
  (ledger-mode "Le") ; "Le " "\u01F15B\uFF44"
  (ledger-report-mode "Ler") ; "LeR \u01F156\u24AD" "\01F15B
  :commands ledger-mode
  :mode "\\.ledger\\'"
  :config
  (setq ledger-post-account-alignment-column 2)
  (setq ledger-post-amount-alignment-column 62))

(use-package flycheck-ledger
  :after (ledger-mode flycheck))

(use-package company-ledger
  :after (ledger-mode company)
  :config
  ;;(add-to-list 'company-backends 'company-ledger)
  ;; Only use company-mode with company-ledger in ledger-mode
  (add-hook 'ledger-mode-hook
            (lambda ()
              (set (make-local-variable 'company-backends)
                   '(company-ledger company-capf company-files)))))

(provide 'ledger-settings)
;;; ledger-settings.el ends here
