All Projects → narendraj9 → Hledger Mode

narendraj9 / Hledger Mode

Licence: gpl-3.0
An Emacs major mode for Hledger

Projects that are alternatives of or similar to Hledger Mode

Plaintextaccounting.github.io
The plaintextaccounting.org website, a portal to Ledger, hledger, beancount and co.
Stars: ✭ 230 (+61.97%)
Mutual labels:  accounting, ledger
nledger
.Net Ledger: Double-Entry Accounting System
Stars: ✭ 141 (-0.7%)
Mutual labels:  accounting, ledger
Ledger Autosync
Synchronize your ledger-cli files with your bank.
Stars: ✭ 189 (+33.1%)
Mutual labels:  accounting, ledger
Abandon
😌 Simple and Robust Accounting
Stars: ✭ 155 (+9.15%)
Mutual labels:  accounting, ledger
Ledger
Double-entry accounting system with a command-line reporting interface
Stars: ✭ 4,062 (+2760.56%)
Mutual labels:  accounting, ledger
ledger2beancount
Ledger to Beancount text-based converter
Stars: ✭ 63 (-55.63%)
Mutual labels:  accounting, ledger
ledg
Batch modifiable ledger-like written in nodejs
Stars: ✭ 32 (-77.46%)
Mutual labels:  accounting, ledger
Awesome Ledger
⭐️ Useful resources for the Ledger command-line accounting system
Stars: ✭ 99 (-30.28%)
Mutual labels:  accounting, ledger
Ledger
Command line double-entry accounting program
Stars: ✭ 272 (+91.55%)
Mutual labels:  accounting, ledger
knut
knut is an efficient plain text accounting tool with support for multiple currencies and valuation.
Stars: ✭ 40 (-71.83%)
Mutual labels:  accounting, ledger
Transity
Keep track of your 💵, 🕘, 🐖, 🐄, 🍻 on your command line
Stars: ✭ 528 (+271.83%)
Mutual labels:  accounting, ledger
Hledger
A reliable, user-friendly Plain Text Accounting tool with command line, terminal and web interfaces.
Stars: ✭ 1,887 (+1228.87%)
Mutual labels:  accounting, ledger
Chainabstractionlayer
Blockchain abstraction layer
Stars: ✭ 131 (-7.75%)
Mutual labels:  ledger
Tron Legacy Emacs Theme
Original retro-futuristic theme inspired by Tron: Legacy
Stars: ✭ 139 (-2.11%)
Mutual labels:  emacs
Emacs Powerthesaurus
Powerthesaurus integration for Emacs
Stars: ✭ 132 (-7.04%)
Mutual labels:  emacs
Nix Doom Emacs
doom-emacs packaged for Nix
Stars: ✭ 132 (-7.04%)
Mutual labels:  emacs
Emacs Cl
Common Lisp implemented in Emacs Lisp.
Stars: ✭ 140 (-1.41%)
Mutual labels:  emacs
Moneygo
An accounting web application to track personal finances written in Go and React/Bootstrap
Stars: ✭ 138 (-2.82%)
Mutual labels:  accounting
Emacs Gdscript Mode
An Emacs package to get GDScript support and syntax highlighting.
Stars: ✭ 132 (-7.04%)
Mutual labels:  emacs
Eval In Repl
Consistent ESS-like eval interface for various REPLs
Stars: ✭ 130 (-8.45%)
Mutual labels:  emacs

hledger-mode

MELPA

A mode for writing hledger journals with a set of useful reports.

Sample Reports

Installation

It's available on MELPA:

M-x package-install hledger-mode

If you are not installing from Melpa, to make hledger-mode available to your Emacs add it to load-path.

(add-to-list 'load-path "/path/to/hledger-mode/dir/")

Setup

;;; Basic configuration
(require 'hledger-mode)

;; To open files with .journal extension in hledger-mode
(add-to-list 'auto-mode-alist '("\\.journal\\'" . hledger-mode))

;; Provide the path to you journal file.
;; The default location is too opinionated.
(setq hledger-jfile "/path/to/your/journal-file.journal")


;;; Auto-completion for account names
;; For company-mode users,
(add-to-list 'company-backends 'hledger-company)

;; For auto-complete users,
(add-to-list 'ac-modes 'hledger-mode)
(add-hook 'hledger-mode-hook
    (lambda ()
        (setq-local ac-sources '(hledger-ac-source))))

Configuration

For configuring various parameters, e.g. the accounts used for computing ratios in the overall report, M-x customize-group and customize the hledger group. For example, the Emergency Fund Ratio is computed with expenses incurred in accounts listed in the variable hledger-ratios-essential-expense-accounts.

Usage

I recommend the following key bindings:

;; Personal Accounting
(global-set-key (kbd "C-c e") 'hledger-jentry)
(global-set-key (kbd "C-c j") 'hledger-run-command)

Once you are in a report buffer after executing a command with hledger-run-command, press h to see the list of reports that you can have a look at. Press s in the overall report to see the meaning of the personal finance ratios for your report.

To enable email reporting, you would need to setup your email api credentials. You can set those up with M-x customize-group hledger.

Once you have done so, you can enable monthly email reporting on hledger-reporting-day with the following in your init.el:

(hledger-enable-reporting)

Here is my configuration with `use-package' declarations:

(use-package hledger-mode
  :pin manual
  :after htmlize
  :load-path "packages/rest/hledger-mode/"
  :mode ("\\.journal\\'" "\\.hledger\\'")
  :commands hledger-enable-reporting
  :preface
  (defun hledger/next-entry ()
    "Move to next entry and pulse."
    (interactive)
    (hledger-next-or-new-entry)
    (hledger-pulse-momentary-current-entry))

  (defface hledger-warning-face
    '((((background dark))
       :background "Red" :foreground "White")
      (((background light))
       :background "Red" :foreground "White")
      (t :inverse-video t))
    "Face for warning"
    :group 'hledger)

  (defun hledger/prev-entry ()
    "Move to last entry and pulse."
    (interactive)
    (hledger-backward-entry)
    (hledger-pulse-momentary-current-entry))

  :bind (("C-c j" . hledger-run-command)
         :map hledger-mode-map
         ("C-c e" . hledger-jentry)
         ("M-p" . hledger/prev-entry)
         ("M-n" . hledger/next-entry))
  :init
  (setq hledger-jfile
        (expand-file-name "~/miscellany/personal/finance/accounting.journal")
        hledger-email-secrets-file (expand-file-name "secrets.el"
                                                     emacs-assets-directory))
  ;; Expanded account balances in the overall monthly report are
  ;; mostly noise for me and do not convey any meaningful information.
  (setq hledger-show-expanded-report nil)

  (when (boundp 'my-hledger-service-fetch-url)
    (setq hledger-service-fetch-url
          my-hledger-service-fetch-url))

  :config
  (add-hook 'hledger-view-mode-hook #'hl-line-mode)
  (add-hook 'hledger-view-mode-hook #'center-text-for-reading)

  (add-hook 'hledger-view-mode-hook
            (lambda ()
              (run-with-timer 1
                              nil
                              (lambda ()
                                (when (equal hledger-last-run-command
                                             "balancesheet")
                                  ;; highlight frequently changing accounts
                                  (highlight-regexp "^.*\\(savings\\|cash\\).*$")
                                  (highlight-regexp "^.*credit-card.*$"
                                                    'hledger-warning-face))))))

  (add-hook 'hledger-mode-hook
            (lambda ()
              (make-local-variable 'company-backends)
              (add-to-list 'company-backends 'hledger-company))))

(use-package hledger-input
  :pin manual
  :load-path "packages/rest/hledger-mode/"
  :bind (("C-c e" . hledger-capture)
         :map hledger-input-mode-map
         ("C-c C-b" . popup-balance-at-point))
  :preface
  (defun popup-balance-at-point ()
    "Show balance for account at point in a popup."
    (interactive)
    (if-let ((account (thing-at-point 'hledger-account)))
        (message (hledger-shell-command-to-string (format " balance -N %s "
                                                          account)))
      (message "No account at point")))

  :config
  (setq hledger-input-buffer-height 20)
  (add-hook 'hledger-input-post-commit-hook #'hledger-show-new-balances)
  (add-hook 'hledger-input-mode-hook #'auto-fill-mode)
  (add-hook 'hledger-input-mode-hook
            (lambda ()
              (make-local-variable 'company-idle-delay)
              (setq-local company-idle-delay 0.1))))

Auxiliary tools

You are welcome to use the web application hosted at vicarie.in for logging data while you are away from computer. You can use the command hledger-fetch-entries later on to get those entries into your journal file.

If you want real-time checking of your journal, you might want to install flycheck-hledger:

flycheck-hledger

Testing

hledger-mode contains automated tests. You may run them by executing cask exec ert-runner.

You may need to install cask locally if you do not already have it installed, and run cask install to install any dependencies that you may be missing.

Contributing

This project is new and improving. Please feel free to contribute to it. You might start with writing a document on contributing to the project or by refactoring it a bit [See hledger-reports.el. It's a mess.].

Cheers!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].