[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
org-sbe recent changes?
From: |
alan . schmitt |
Subject: |
org-sbe recent changes? |
Date: |
Sun, 30 Oct 2022 19:07:21 +0100 |
Hello,
I’ve been using ledger and an org-mode table to track my finances for a
long time, and today it broke: when I evaluate a table macro, I get an
#ERROR instead of the computed value.
The code I’m using is still the one from here:
https://alan.petitepomme.net/tips/ledger_and_org.html
Basically I define a function like this (I added the message part for
debugging):
#+name: call_ledger
#+begin_src emacs-lisp :var lcmd="bal" :var bucket="Quotidien" :var
prefix="Expenses:" :var period=()
(let* ((name (org-trim bucket))
(bname (concat "'^" prefix name "'"))
(ledger "ledger -f ~/Documents/Org/mescomptes.ledger")
(parg (when period (concat " -p '" period "'")))
(cutcmd "tail -1 | cut -d ' ' -f 2")
(cmd
(concat ledger " -J " parg " " lcmd " " bname " | " cutcmd))
(res (org-trim (shell-command-to-string cmd))))
(message res)
(if (equal res "") 0 res))
#+end_src
Then I call it in a table that looks like this (removing a lot of stuff
for privacy reasons):
| Bucket | Planned | Remaining |
|--------------------------------+---------+-----------+
| Achat Maison | 1000 | #ERROR |
|--------------------------------+---------+-----------+
| Total | 1000 | #ERROR |
#+TBLFM: @2$3..@>>$3='(org-sbe call_ledger (bucket $$1) (prefix
"\"Bucket:Expenses:\""))
It used to work, but now I get an #ERROR. The strange thing is that the
correct value is printed with the message call. Did something change
recently regarding org-sbe and table? How can I find out what the
value is causing the #ERROR to be printed?
Thanks,
Alan
signature.asc
Description: PGP signature
- org-sbe recent changes?,
alan . schmitt <=