#+TITLE: Finance layer

* Table of Contents                                         :TOC_4_gh:noexport:
 - [[#description][Description]]
 - [[#install][Install]]
   - [[#layer][Layer]]
 - [[#configuration][Configuration]]
   - [[#ledger][Ledger]]
 - [[#key-bindings][Key bindings]]
   - [[#ledger][Ledger]]

* Description

This layer adds finance related packages:
- [[https://github.com/ledger/ledger][ledger]] support via [[https://github.com/ledger/ledger/tree/next/lisp][ledger-mode]]

[[file:img/ledger.png]]

* Install
** Layer
To use this configuration layer, add it to your =~/.spacemacs=. You will need to
add =finance= to the existing =dotspacemacs-configuration-layers= list in this
file.

* Configuration

** Ledger

You can set what column transaction posts are aligned to on
the right by setting the variable =ledger-post-amount-alignment-column= in
your =dotspacemacs/user-config=.  The default value, set in the layer, is =62=.

#+BEGIN_SRC emacs-lisp
  (defun dotspacemacs/user-config ()
    (setq ledger-post-amount-alignment-column 68))
#+END_SRC

* Key bindings

** Ledger

| Key Binding | Description                                   |
|-------------+-----------------------------------------------|
| ~SPC m a~   | add a transaction                             |
| ~SPC m b~   | edit a post amount with Emacs Calculator mode |
| ~SPC m c~   | toggle 'cleared' flag on transaction or post  |
| ~SPC m C~   | sort and align the entire buffer              |
| ~SPC m d~   | delete current transaction                    |
| ~SPC m p~   | display balance at point                      |
| ~SPC m q~   | align a single transaction's posts            |
| ~SPC m r~   | reconcile an account                          |
| ~SPC m R~   | display a report                              |
| ~SPC m t~   | append an effective date to a post            |
| ~SPC m y~   | set the year for quicker entry                |
| ~SPC m RET~ | set the month for quicker entry               |
