Re: [O] Org and ledger
Sharon, a reference to another possibly useful tutorial was posted to the ledger newsgroup a while ago: From: Simon Michael simon-jbxitmbj2llqt0dzr+a...@public.gmane.org Subject: Re: ledger basics and habits Newsgroups: gmane.comp.finance.ledger.general To: ledger-cli-/jypxa39uh5tlh3mboc...@public.gmane.org Date: Sun, 22 Jun 2014 08:28:28 -0700 (20 weeks, 16 hours, 2 minutes ago) Thanks! The http://matthewturland.com/2014/03/29/ledger-basics-and-habits post is the best short-medium intro I've seen yet. Now featuring on https://twitter.com/LedgerTips . I've not had a chance to read the post so cannot say how good it might be but you may wish to follow this up. -- : Eric S Fraga (0xFFFCF67D), Emacs 24.3.1, Org release_8.3beta-372-gdd70cf
Re: [O] Org and ledger
El Mon, 10 Nov 2014 08:08:51 +0100 Bernhard Pröll va escriure: I have been curious too and found this file: https://bitbucket.org/blais/beancount/src/tip/examples/tutorial/example.beancount Exactly. The first line defines org mode: ;; -*- mode: org; mode: beancount; -*-
Re: [O] Org and ledger
On Sunday, 9 Nov 2014 at 11:34, Daniel Clemente wrote: [...] I prefer beancount (very similar to ledger but stricter): beancount supports org out of the box! My beancount file is an org file (with structure, tasks, priorities, agenda, etc. except :CLOCK:) and it parses correctly as a ledger. Interesting. Could you post an example file? The documentation you linked to on Google docs does not mention org anywhere that I could see. thanks. -- : Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.1, Org release_8.3beta-475-g25d50e
Re: [O] Org and ledger
I have been curious too and found this file: https://bitbucket.org/blais/beancount/src/tip/examples/tutorial/example.beancount Eric S Fraga e.fr...@ucl.ac.uk schrieb am Sun, 09. Nov 13:29: On Sunday, 9 Nov 2014 at 11:34, Daniel Clemente wrote: [...] I prefer beancount (very similar to ledger but stricter): beancount supports org out of the box! My beancount file is an org file (with structure, tasks, priorities, agenda, etc. except :CLOCK:) and it parses correctly as a ledger. Interesting. Could you post an example file? The documentation you linked to on Google docs does not mention org anywhere that I could see. thanks. -- : Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.1, Org release_8.3beta-475-g25d50e -- mit freundlichen Grüßen Bernhard Pröll
Re: [O] Org and ledger
On Friday, 7 Nov 2014 at 19:53, Sharon Kimble wrote: [...] having a play with it over the weekend. And I reckon that I will be keeping my own instruction docs which might be able to be used to setup another tutorial later on, but lets try walking before running though! :) Sharon. Sharon, I'm online now. You can find the org tutorial for ledger with a simple example at http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-ledger.html -- : Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.1, Org release_8.3beta-475-g25d50e
Re: [O] Org and ledger
Well, ledger and hledger are different tools that use the same (very similar) data files. The invocation of each is different. org supports ledger out of the box but not hledger. I prefer beancount (very similar to ledger but stricter): beancount supports org out of the box! My beancount file is an org file (with structure, tasks, priorities, agenda, etc. except :CLOCK:) and it parses correctly as a ledger. So I don't use beancount support in org, but the reverse. It also includes Emacs mode, fontification, autocomplete, … http://furius.ca/beancount/
Re: [O] Org and ledger
Alan Schmitt alan.schm...@polytechnique.org writes: Thanks Alan for this. Ledger is something that I would dearly love to be using, but I can't find a good tutorial [by which I mean, it works in small steps which build on the previous steps]. I've looked at http://lists.gnu.org/archive/html/emacs-orgmode/2014-04/msg00727.html http://orgmode.org/worg/org-tutorials/weaving-a-budget.html http://hledger.org/step-by-step The last one looked the most promising until I tried ledger add which replied - --8---cut here---start-8--- ledger add -f ~/.emacs.d/ledger/ledger.journal Error: Unrecognized command 'add' --8---cut here---end---8--- So now I'm stumped! Sharon. On 2014-10-31 12:32, Vikas Rawal vikasli...@agrarianresearch.org writes: snip. I generate reports and deal with my budget using org. I describe my setup here: http://lists.gnu.org/archive/html/emacs-orgmode/2014-04/msg00727.html Since then, I've slightly refined these functions, here is the current version: #+begin_src org #+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 (if (equal res ) 0 res)) #+end_src #+name: monthly_average_since #+begin_src emacs-lisp :var start-date=2014-03-01 :var amount=100 (let ((nbdays (- (time-to-days (current-time)) (time-to-days (org-read-date nil t start-date) (calc-eval round($ / (12 * ($$ / 365.25)), 2) nil amount nbdays)) #+end_src #+name: monthly_average #+begin_src emacs-lisp :var starty=2014 :var startm=3 :var amount=100 (let* ((tm (decode-time)) (cmonth (nth 4 tm)) (cyear (nth 5 tm)) (nbmonths (+ (* 12 (- cyear starty)) (- cmonth startm (calc-eval round($ / $$, 2) nil amount nbmonths)) #+end_src #+name: ledger_average #+begin_src emacs-lisp :var b=Quotidien :var sy=2014 :var sm=3 :var sd=2014-03-01 :var p=Expenses: (let* ((per (format from %d-%d-01 to this month sy sm)) (a (org-sbe call_ledger (bucket (eval b)) (prefix (eval p)) (period (eval per) (org-sbe monthly_average (amount (eval a)) (starty (eval sy)) (startm (eval sm #+end_src #+name: ledger_budget #+BEGIN_SRC emacs-lisp :results output :var table=budget :var year=2014 :var month=04 (princ (format %d-%02d-01 * Budget %d %02d\n year month year month)) (mapcar (lambda (tuple) (princ (format Bucket:Expenses:%s%d €\n (car tuple) (cadr tuple (butlast (cdr table) 1)) (princ Bucket:Unallocated:EUR\n) #+END_SRC #+end_src The table looks like this now #+begin_src org #+name: budget | Bucket | Planned | Remaining | This Month | Last Month | Average | |+-+---+++-| | Name || | | || |+-+---+++-| | Total || | | || #+TBLFM: @2$3..@$3='(org-sbe call_ledger (bucket (concat \ $1 \)) (prefix \Bucket:Expenses:\)) #+TBLFM: @2$4..@$4='(org-sbe call_ledger (bucket (concat \ $1 \)) (period \this month\)) #+TBLFM: @2$5..@$5='(org-sbe call_ledger (bucket (concat \ $1 \)) (period \last month\)) #+TBLFM: @2$6..@$6='(org-sbe ledger_average (b (concat \ $1 \))) #+TBLFM: @$2..@$6=vsum(@2..@-1) #+end_src Best, Alan -- A taste of linux = http://www.sharons.org.uk my git repo = https://bitbucket.org/boudiccas/dots TGmeds = http://www.tgmeds.org.uk Debian testing, fluxbox 1.3.5, emacs 24.4.1.0 signature.asc Description: PGP signature
Re: [O] Org and ledger
Sharon Kimble boudic...@skimble.plus.com writes: Alan Schmitt alan.schm...@polytechnique.org writes: Thanks Alan for this. Ledger is something that I would dearly love to be using, but I can't find a good tutorial [by which I mean, it works in small steps which build on the previous steps]. I've looked at http://lists.gnu.org/archive/html/emacs-orgmode/2014-04/msg00727.html http://orgmode.org/worg/org-tutorials/weaving-a-budget.html http://hledger.org/step-by-step The last one looked the most promising until I tried ledger add which replied - ledger add -f ~/.emacs.d/ledger/ledger.journal Error: Unrecognized command 'add' So now I'm stumped! That last link is a tutorial for hledger, which actually isn't the same as normal ledger -- it's sort of inspired by ledger, but has different commands, as you discovered. Documentation for ledger is a little spotty. I've found the official docs to be better than anything else, though they still leave a little to be desired: http://www.ledger-cli.org/3.0/doc/ledger3.html#Ledger-Tutorial
Re: [O] Org and ledger
Eric Abrahamsen e...@ericabrahamsen.net writes: Sharon Kimble boudic...@skimble.plus.com writes: Alan Schmitt alan.schm...@polytechnique.org writes: Thanks Alan for this. Ledger is something that I would dearly love to be using, but I can't find a good tutorial [by which I mean, it works in small steps which build on the previous steps]. I've looked at http://lists.gnu.org/archive/html/emacs-orgmode/2014-04/msg00727.html http://orgmode.org/worg/org-tutorials/weaving-a-budget.html http://hledger.org/step-by-step The last one looked the most promising until I tried ledger add which replied - ledger add -f ~/.emacs.d/ledger/ledger.journal Error: Unrecognized command 'add' So now I'm stumped! That last link is a tutorial for hledger, which actually isn't the same as normal ledger -- it's sort of inspired by ledger, but has different commands, as you discovered. Documentation for ledger is a little spotty. I've found the official docs to be better than anything else, though they still leave a little to be desired: http://www.ledger-cli.org/3.0/doc/ledger3.html#Ledger-Tutorial Thanks Erik, that looks understandable and comprehensive, so I'll try having a play with it over the weekend. And I reckon that I will be keeping my own instruction docs which might be able to be used to setup another tutorial later on, but lets try walking before running though! :) Sharon. -- A taste of linux = http://www.sharons.org.uk my git repo = https://bitbucket.org/boudiccas/dots TGmeds = http://www.tgmeds.org.uk Debian testing, fluxbox 1.3.5, emacs 24.4.1.0 signature.asc Description: PGP signature
Re: [O] Org and ledger
On Friday, 7 Nov 2014 at 13:19, Sharon Kimble wrote: Alan Schmitt alan.schm...@polytechnique.org writes: Thanks Alan for this. Ledger is something that I would dearly love to be using, but I can't find a good tutorial [by which I mean, it works in small steps which build on the previous steps]. I've looked at http://lists.gnu.org/archive/html/emacs-orgmode/2014-04/msg00727.html http://orgmode.org/worg/org-tutorials/weaving-a-budget.html http://hledger.org/step-by-step The last one looked the most promising until I tried ledger add which replied - ledger add -f ~/.emacs.d/ledger/ledger.journal Error: Unrecognized command 'add' So now I'm stumped! Well, ledger and hledger are different tools that use the same (very similar) data files. The invocation of each is different. org supports ledger out of the box but not hledger. The ledger manual is good enough to get started, in my opinion, if you stick to the simple examples and don't try to customise much. There is a short org ledger tutorial on Worg. I'm offline at the moment so cannot give you the link but it's there! I wrote it... :) -- : Eric S Fraga (0xFFFCF67D), Emacs 24.3.1, Org release_8.3beta-372-gdd70cf
Re: [O] Org and ledger
On 2014-10-31 12:32, Vikas Rawal vikasli...@agrarianresearch.org writes: 2. Generating reports: Babel results do not use the standard Org table syntax. Given my limited knowledge of lisp, I am finding it difficult to programme customising these reports in Org. It would be of much benefit if other users could share how they customise ledger reports in Org. Some examples would be great. I generate reports and deal with my budget using org. I describe my setup here: http://lists.gnu.org/archive/html/emacs-orgmode/2014-04/msg00727.html Since then, I've slightly refined these functions, here is the current version: #+begin_src org #+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 (if (equal res ) 0 res)) #+end_src #+name: monthly_average_since #+begin_src emacs-lisp :var start-date=2014-03-01 :var amount=100 (let ((nbdays (- (time-to-days (current-time)) (time-to-days (org-read-date nil t start-date) (calc-eval round($ / (12 * ($$ / 365.25)), 2) nil amount nbdays)) #+end_src #+name: monthly_average #+begin_src emacs-lisp :var starty=2014 :var startm=3 :var amount=100 (let* ((tm (decode-time)) (cmonth (nth 4 tm)) (cyear (nth 5 tm)) (nbmonths (+ (* 12 (- cyear starty)) (- cmonth startm (calc-eval round($ / $$, 2) nil amount nbmonths)) #+end_src #+name: ledger_average #+begin_src emacs-lisp :var b=Quotidien :var sy=2014 :var sm=3 :var sd=2014-03-01 :var p=Expenses: (let* ((per (format from %d-%d-01 to this month sy sm)) (a (org-sbe call_ledger (bucket (eval b)) (prefix (eval p)) (period (eval per) (org-sbe monthly_average (amount (eval a)) (starty (eval sy)) (startm (eval sm #+end_src #+name: ledger_budget #+BEGIN_SRC emacs-lisp :results output :var table=budget :var year=2014 :var month=04 (princ (format %d-%02d-01 * Budget %d %02d\n year month year month)) (mapcar (lambda (tuple) (princ (format Bucket:Expenses:%s%d €\n (car tuple) (cadr tuple (butlast (cdr table) 1)) (princ Bucket:Unallocated:EUR\n) #+END_SRC #+end_src The table looks like this now #+begin_src org #+name: budget | Bucket | Planned | Remaining | This Month | Last Month | Average | |+-+---+++-| | Name | … | … | … | … | … | |+-+---+++-| | Total | … | … | … | … | … | #+TBLFM: @2$3..@$3='(org-sbe call_ledger (bucket (concat \ $1 \)) (prefix \Bucket:Expenses:\)) #+TBLFM: @2$4..@$4='(org-sbe call_ledger (bucket (concat \ $1 \)) (period \this month\)) #+TBLFM: @2$5..@$5='(org-sbe call_ledger (bucket (concat \ $1 \)) (period \last month\)) #+TBLFM: @2$6..@$6='(org-sbe ledger_average (b (concat \ $1 \))) #+TBLFM: @$2..@$6=vsum(@2..@-1) #+end_src Best, Alan -- OpenPGP Key ID : 040D0A3B4ED2E5C7 signature.asc Description: PGP signature
Re: [O] Org and ledger
On Friday, 31 Oct 2014 at 12:32, Vikas Rawal wrote: I have started using ledger with Org, and would be interested in knowing experiences of other users. I use ledger within org in the literate programming sense. This allows me to have different ledger entries all over the place under different headings but can then use one src block to generate whatever I want, either a balance or a register, say. 2. Generating reports: Babel results do not use the standard Org table syntax. Yes, this is true. It may be possible to change the output of ledger (using --format, say) to something that babel could process into a table. However, I do find ledger a little clumsy in this regard but maybe that's just the documentation. An extra complication is the big difference between ledger v2 and v3 in terms of invoking it. What version are you using? -- : Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.1, Org release_8.3beta-475-g25d50e
[O] Org and ledger
I have started using ledger with Org, and would be interested in knowing experiences of other users. I see two sets of uses in combining Ledger with Org. 1. Record keeping of transactions: Org works with ledger mainly through babel. Has anyone considered the possibility of maintaining the records natively in Org, which could be exported to ledger? Keeping native ledger source blocks in Org does not seem to add much value as far as maintaining books is concerned. Some people have tried some basic expense recording in Org, but to my knowledge, these solutions do not talk to ledger. 2. Generating reports: Babel results do not use the standard Org table syntax. Given my limited knowledge of lisp, I am finding it difficult to programme customising these reports in Org. It would be of much benefit if other users could share how they customise ledger reports in Org. Some examples would be great. Vikas
Re: [O] Org and ledger
Vikas Rawal vikasli...@agrarianresearch.org writes: I have started using ledger with Org, and would be interested in knowing experiences of other users. I see two sets of uses in combining Ledger with Org. 1. Record keeping of transactions: Org works with ledger mainly through babel. Has anyone considered the possibility of maintaining the records natively in Org, which could be exported to ledger? Keeping native ledger source blocks in Org does not seem to add much value as far as maintaining books is concerned. Some people have tried some basic expense recording in Org, but to my knowledge, these solutions do not talk to ledger. I've certainly thought about it :) I think the ideal solution for me would be org headings with ledger-specific properties. So you could have date and payee properties (defaulting to using the heading text and any timestamp present), and then as many LEDGER_POSTING properties as you like. You could export a subtree of postings to a real ledger file, and there would be an export-and-archive command that would permanently retire a set of org headings as a ledger file. When keeping track of payments I need to make, or need to receive, the duplication of data in my org and ledger files has always annoyed me. I haven't actually done anything about it, though :) 2. Generating reports: Babel results do not use the standard Org table syntax. Given my limited knowledge of lisp, I am finding it difficult to programme customising these reports in Org. It would be of much benefit if other users could share how they customise ledger reports in Org. Some examples would be great. Can't help here, sorry.