# Accounting in Emacs with Ledger Mode - System Crafters Live!

**URL:** <https://forum.systemcrafters.net/t/accounting-in-emacs-with-ledger-mode-system-crafters-live/1549>\
**Category:** General\
**Created:** [April 11, 2025, 2:33pm UTC](https://forum.systemcrafters.net/t/accounting-in-emacs-with-ledger-mode-system-crafters-live/1549 "2025-04-11T14:33:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ashraz](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.systemcrafters.net/ashraz/32/509_2.png) [@ashraz](https://forum.systemcrafters.net/u/ashraz)\
**Post date:** [April 11, 2025, 2:33pm UTC](https://forum.systemcrafters.net/t/accounting-in-emacs-with-ledger-mode-system-crafters-live/1549/1 "2025-04-11T14:33:25Z")

</div>

[![](https://canada1.discourse-cdn.com/flex029/uploads/systemcrafters/original/1X/a69d92f6e7d6481a242036f5977af93979dc7ca5.jpeg "Accounting in Emacs with Ledger Mode - System Crafters Live!") ](https://www.youtube.com/watch?v=iBCBDtVm_hg)

2025-04-11T15:00:00Z

---

<div class="post-metadata">

**Author:** ![dgr](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.systemcrafters.net/dgr/32/394_2.png) [@dgr](https://forum.systemcrafters.net/u/dgr)\
**Post date:** [April 11, 2025, 5:12pm UTC](https://forum.systemcrafters.net/t/accounting-in-emacs-with-ledger-mode-system-crafters-live/1549/2 "2025-04-11T17:12:25Z")

</div>

Here the org-file I mentioned in the stream.

It allows me to have an eye on how many service hours I have left in my budget with my external partner.

```auto
* Example
#+NAME: LedgerCli
#+begin_src ledger :results raw :cmdline reg "Assets:4501580666" --exchange h --format='| %D | %T | \n'
  P 2024/01/01 00:00:00 h CHF 180

  2024/01/01 * Opening Balance
      Assets:4501580666 CHF 30000 ; Kostendach
      Equity:Opening Balance

  2024/01/08 * LFI-005977
      Spending:monatliche Grundgebühr "SnS v3: Bronze" 12 @ CHF 200
      Assets:4501580666 CHF -2400.00

  2024/02/01 * LFI-005996
      Spending:SH h 0.5 ;
      Spending:SH h 1.25 ;
      Spending:SH h 1.25 ;
      Spending:SH h 1 ;
      Assets:4501580666 CHF -720

  
#+end_src

#+Name: ledgercli-table
#+RESULTS: LedgerCli

#+begin_src python :var t=ledgercli-table :results output drawer
  print("#+Name: ledger-cli-table-no-currency")
  for l in t:
    if l[1] == 0:
      l[1] = '0.0 h'
    if l[1] == '50.8m':
      l[1] = '0.846 h'
    print(("| {col1} | {col2} |").format( col1=l[0], col2=l[1].split(' ')[0] ))
#+end_src

#+RESULTS:
:results:
#+Name: ledger-cli-table-no-currency
:end:

#+begin_src gnuplot :var data=ledger-cli-table-no-currency :file gnuplot.sh.png :exports results output
  set term pngcairo font 'arial,11' size 1200,600
  set xdata time
  set style data linespoints
  set timefmt "%Y/%m/%d"
  set xrange ['2024/01/01':'2025/01/103']
  set format x "%d.%m"
  set yrange [-10:170]

  set style line 100 lt 1 lc rgb "gray" lw 1
  set style line 101 lt 0.5 lc rgb "gray" lw 1

  set grid mytics ytics ls 100, ls 101
  set grid mxtics xtics ls 100, ls 101
  set offset 1,1,1,1

  set title "Service und Support Bronze 2024" font 'arial,16'
  plot data u 1:2 lw 2 with fillsteps notitle,\
       data u 1:2:(sprintf("%3.2f h", $2)) with labels point pt 11 offset char 4,2 rotate by 45 notitle
#+end_src

#+RESULTS:

```

 ![gnuplot.sh](https://canada1.discourse-cdn.com/flex029/uploads/systemcrafters/original/1X/6110c8461877645d9b4b21efcdb45e89a7411562.png)

In the end I upload both files to the internal wiki so others without Emacs can also access the information.

---

<div class="post-metadata">

**Author:** ![spacefrogg](https://avatars.discourse-cdn.com/v4/letter/s/a4c791/32.png) [@spacefrogg](https://forum.systemcrafters.net/u/spacefrogg)\
**Post date:** [April 14, 2025, 1:55pm UTC](https://forum.systemcrafters.net/t/accounting-in-emacs-with-ledger-mode-system-crafters-live/1549/3 "2025-04-14T13:55:41Z")

</div>

I don’t know if that has come around to distributions, yet. But I implemented GPG file support for ledger quite awhile ago. If you build ledger with GPGME support, you will not only enjoy transparent encryption/decryption of ledger files in Emacs (which you can do already), but your actual accounting and reporting functions will also transparently work on encrypted ledger files.
