emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Tips for using orgmode + ledger to record events?
@ 2013-02-27 10:29 Harum Budi
  2013-03-01  8:47 ` Eric S Fraga
  0 siblings, 1 reply; 10+ messages in thread
From: Harum Budi @ 2013-02-27 10:29 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 570 bytes --]

Hi all (posted to orgmode and ledger-cli list),

I'm looking for ideas/tips on how to best record events using orgmode and
ledger. By events I mean things like buying/paying a certain item
(groceries, online payment, dining out), going to a certain place (haircut
appointment, going to the gym), etc.

Many of the events have its respective ledger journal because they involve
buying/selling. But some other events do not involve money/ledger.

I want to avoid duplication (recording both in .org file as well as ledger
journal).

How do you guys do it?

Regards,
Harum

[-- Attachment #2: Type: text/html, Size: 735 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Tips for using orgmode + ledger to record events?
  2013-02-27 10:29 Tips for using orgmode + ledger to record events? Harum Budi
@ 2013-03-01  8:47 ` Eric S Fraga
  2013-03-01 10:09   ` Harum Budi
  0 siblings, 1 reply; 10+ messages in thread
From: Eric S Fraga @ 2013-03-01  8:47 UTC (permalink / raw)
  To: Harum Budi; +Cc: emacs-orgmode

Harum,

I am not entirely sure what you are asking.  I use ledger with org all
the time to track my finances.  I use babel for this so have entries
that look like this:

#+name: expenses
#+begin_src ledger :noweb yes
<<expenses-car>>
<<expenses-council>>
<<expenses-credit-cards>>
<<expenses-insurance>>
<<expenses-taxes>>
<<expenses-utilities>>
#+end_src

and then have individual blocks for each of these sub-items.  I then
also have something that brings everything together, including expenses
(as noted above), income, etc.:

#+name: assets
#+begin_src ledger :cmdline -V -s bal assets :results output :noweb yes
<<commodity-prices>>
<<opening-balances>>
<<income>>
<<savings>>
<<expenses>>
#+end_src

I use :noweb to allow me to build up the complete ledger file.

HTH,
eric

-- 
: Eric S Fraga, GnuPG: 0xC89193D8FFFCF67D
: in Emacs 24.3.50.1 and Org release_7.9.3f-1199-g3a0e55

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Tips for using orgmode + ledger to record events?
  2013-03-01  8:47 ` Eric S Fraga
@ 2013-03-01 10:09   ` Harum Budi
  2013-03-01 13:11     ` Eric S Fraga
  0 siblings, 1 reply; 10+ messages in thread
From: Harum Budi @ 2013-03-01 10:09 UTC (permalink / raw)
  To: Harum Budi, emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 3619 bytes --]

I was not being clear at all, sorry. Let me rephrase, but bear with me as
English is my secondary language.

For more than a decade, I've maintained a log.txt file with content like
this (events are fictional):

2005-01-02 [friend] Met high school buddy Frank, talked about A, B, C. He
is now married, his wife's name is Laura.
2006-04-06 [gadget] Bought Nokia Communicator 9300 for $500.
2007-12-30 [health] Took worm medicine, along with all family members
@1000mg (Fido included, 125mg).
2008-10-20 -2008-10-22 [vacation] Went to Bali with Denise. Took many
photos (burnt to CD #2341).

This log helps me:
* remember when I bought stuffs (not all purchases are being recorded of
course). Sometimes I update these records to note service/repair, when I
resold the stuffs to others, when the stuff got stolen, etc.
* remember when I got sick, had my blood tested, donated blood, had
doctor/dentist appointment, etc.
* remember when I last meet people (again, not all people).

The format of the file makes it convenient to grep. I plan to convert this
to log.org with format like this:

* [2013-02-21 ] Met high school buddy Lucie    :friend:
* [2013-03-01 ] Fido died :(   :pet:

The last 1-2 years of using org/org-mode (and later, ledger-cli) has
brought me much joy because of the outline, richer formatting, syntax
highlighting of timestamps, etc. But it also leads to some issues.

* Duplication. Financial events like buying stuffs are now recorded twice,
once in log.org and another in ledger journal. Should I just stop logging
in log.org for this? Or should I use Org links to link to the appropriate
ledger journal entry?

Past events that are in the reminder are also now in the LOGBOOK drawer,
but not all of them yet. Some events do not have reminders so they will
still need log.org.

* Sometimes I want to write a longer entry than just a long line. The new
log.org format is nice and will let me put detailed note under each
heading. But then I will lose the nice property of one-record-on-each-line
and grep-ping things will not be as straightforward.

If this is still unclear, it is because I'm still not sure how to organize
it all. I have hundreds of .org files now and things are getting rather
messy. But I guess my main issue is: I still want to maintain log.txt/
log.org and would like to have some scripts/utilities to automatically add
records to this file instead of me having to do it manually. log.txt + grep
has been quite useful for me for quick-searching/counting/viewing past
events, and I don't think I want to lose this.

But other thoughts and ideas are certainly welcome.

Harum


2013/3/1 Eric S Fraga <e.fraga@ucl.ac.uk>

> Harum,
>
> I am not entirely sure what you are asking.  I use ledger with org all
> the time to track my finances.  I use babel for this so have entries
> that look like this:
>
> #+name: expenses
> #+begin_src ledger :noweb yes
> <<expenses-car>>
> <<expenses-council>>
> <<expenses-credit-cards>>
> <<expenses-insurance>>
> <<expenses-taxes>>
> <<expenses-utilities>>
> #+end_src
>
> and then have individual blocks for each of these sub-items.  I then
> also have something that brings everything together, including expenses
> (as noted above), income, etc.:
>
> #+name: assets
> #+begin_src ledger :cmdline -V -s bal assets :results output :noweb yes
> <<commodity-prices>>
> <<opening-balances>>
> <<income>>
> <<savings>>
> <<expenses>>
> #+end_src
>
> I use :noweb to allow me to build up the complete ledger file.
>
> HTH,
> eric
>
> --
> : Eric S Fraga, GnuPG: 0xC89193D8FFFCF67D
> : in Emacs 24.3.50.1 and Org release_7.9.3f-1199-g3a0e55
>
>

[-- Attachment #2: Type: text/html, Size: 4814 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Tips for using orgmode + ledger to record events?
  2013-03-01 10:09   ` Harum Budi
@ 2013-03-01 13:11     ` Eric S Fraga
  2013-03-01 14:17       ` Jeffrey Brent McBeth
  2013-03-01 20:13       ` Viktor Rosenfeld
  0 siblings, 2 replies; 10+ messages in thread
From: Eric S Fraga @ 2013-03-01 13:11 UTC (permalink / raw)
  To: Harum Budi; +Cc: emacs-orgmode

Harum Budi <harumbudi@gmail.com> writes:

> I was not being clear at all, sorry. Let me rephrase, but bear with me as
> English is my secondary language.

That's fine!

I think I understand what you want.  My view would be to avoid having
two files, an org one and a ledger one, and instead combine them into an
org file.  You could create log capture templates for different kinds of
activities and one of these could be financial.  This latter one could
create a ledger src block that is automatically tangled to the full
ledger file consisting of all such entries.  This is why I showed the
ledger src blocks in my previous email.

A financial entry could be

,----
| * [2013-03-01 Fri] Bought a sandwich  :food:
|   #+begin_src ledger :tangle "finances.ledger"
|   2013/03/01 Bought a sandwich
|     expenses  £3.50
|     cash
|   #+end_src
`----

or something similar...  You could still grep on headings but actually
tag searching would be better of course.

Just a thought.
-- 
: Eric S Fraga, GnuPG: 0xC89193D8FFFCF67D
: in Emacs 24.3.50.1 and Org release_7.9.3f-1313-g7d4812

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Tips for using orgmode + ledger to record events?
  2013-03-01 13:11     ` Eric S Fraga
@ 2013-03-01 14:17       ` Jeffrey Brent McBeth
  2013-03-01 20:13       ` Viktor Rosenfeld
  1 sibling, 0 replies; 10+ messages in thread
From: Jeffrey Brent McBeth @ 2013-03-01 14:17 UTC (permalink / raw)
  To: emacs-orgmode

On Fri, Mar 01, 2013 at 01:11:59PM +0000, Eric S Fraga wrote:
> Harum Budi <harumbudi@gmail.com> writes:
> 
> > I was not being clear at all, sorry. Let me rephrase, but bear with me as
> > English is my secondary language.
> 
> That's fine!
> 
> I think I understand what you want.  My view would be to avoid having
> two files, an org one and a ledger one, and instead combine them into an
> org file.  You could create log capture templates for different kinds of
> activities and one of these could be financial.  This latter one could
> create a ledger src block that is automatically tangled to the full
> ledger file consisting of all such entries.  This is why I showed the
> ledger src blocks in my previous email.
> 
> A financial entry could be
> 
> ,----
> | * [2013-03-01 Fri] Bought a sandwich  :food:
> |   #+begin_src ledger :tangle "finances.ledger"
> |   2013/03/01 Bought a sandwich
> |     expenses  £3.50
> |     cash
> |   #+end_src
> `----
> 
> or something similar...  You could still grep on headings but actually
> tag searching would be better of course.

I'm doing something rather similar with Ledger, and it all works really well unless I want to export to HTML, in which case I've had to increase the max lisp eval depth about once a week lately
(setq max-lisp-eval-depth 2400)

I'm assuming I'm doing something wrong there.  The datetree is not exported, but reports are (I have an example of a report below):

#+name: savingscheckingsummary
#+begin_src ledger :cmdline balance esl:check savings -p "until tomorrow" :nowe$
<<budget>>
<<checking>>
<<savings>>
<<anotheraccount>>
<<creditcard>>
#+end_src

I find the noweb tangling to work really well for my purposes, and in particular subsetting which bits I want exported to Ledger.

I've also included an example capture template

(setq org-capture-templates
  (append '(("l" "Ledger entries")
            ("lc" "Bank:Checking" plain
                 (file+datetree+prompt "~/Documents/Ledger.org")
"
#+name: checking
#+begin_src ledger
%(org-read-date) * %^{Payee}
    Expenses:%^{Account}  %^{Amount}
    Assets:Bank:Checking
#+end_src
"))))



-- 
"The man who does not read good books has no advantage over 
 the man who cannot read them."
 -- Mark Twain

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Tips for using orgmode + ledger to record events?
  2013-03-01 13:11     ` Eric S Fraga
  2013-03-01 14:17       ` Jeffrey Brent McBeth
@ 2013-03-01 20:13       ` Viktor Rosenfeld
  2013-03-04  8:52         ` Eric S Fraga
  1 sibling, 1 reply; 10+ messages in thread
From: Viktor Rosenfeld @ 2013-03-01 20:13 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Harum Budi

Hi,

Eric S Fraga wrote:

> My view would be to avoid having two files, an org one and a ledger
> one, and instead combine them into an org file. 

I'm using both org-mode and ledger but I do not mix them. I'm having a
hard time imagining the benefits of such a system, especially since
ledger's query functionality is so powerful. It seems to that this just
adds lot's of unnecessary complexity. But I'm interested to hear what
advantages you derive from the combined approach.

Cheers,
Viktor

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Tips for using orgmode + ledger to record events?
  2013-03-01 20:13       ` Viktor Rosenfeld
@ 2013-03-04  8:52         ` Eric S Fraga
  2013-03-04 21:06           ` Viktor Rosenfeld
  0 siblings, 1 reply; 10+ messages in thread
From: Eric S Fraga @ 2013-03-04  8:52 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Harum Budi

Viktor Rosenfeld <listuser36@gmail.com> writes:

> Hi,
>
> Eric S Fraga wrote:
>
>> My view would be to avoid having two files, an org one and a ledger
>> one, and instead combine them into an org file. 
>
> I'm using both org-mode and ledger but I do not mix them. I'm having a
> hard time imagining the benefits of such a system, especially since
> ledger's query functionality is so powerful. It seems to that this just
> adds lot's of unnecessary complexity. But I'm interested to hear what
> advantages you derive from the combined approach.
>
> Cheers,
> Viktor

Hi Viktor,

for me, the advantages from combining the two, using babel, is that I
can have all kinds of documentation associated with my finances in one
document including not just the transactions but also background
information (e.g. account information, expenses information).  The
advantages are those of literate programming in general.

Using org for this is easier than having to work with ledger
comments.  I can also then include, in the org file, the specific ledger
instantiations to get the kinds of reports I want and execute these with
C-c C-c.  So, for instance, I have ledger reports on the current
balances, the taxable income from any particular year, etc.

None of this is impossible with a ledger file instead of an org one, of
course, other than I can never remember all the various incantations
required by ledger to get the specific reports I want.  If I had a
separate set of ledger files, I would still end up having the various
incantations recorded somewhere, maybe as shell scripts or aliases.  I
find it easier to have everything in one place.

YMMV, of course!

-- 
: Eric S Fraga, GnuPG: 0xC89193D8FFFCF67D
: in Emacs 24.3.50.1 and Org release_7.9.3f-1199-g3a0e55

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Tips for using orgmode + ledger to record events?
  2013-03-04  8:52         ` Eric S Fraga
@ 2013-03-04 21:06           ` Viktor Rosenfeld
  2013-03-05  8:44             ` Eric S Fraga
  0 siblings, 1 reply; 10+ messages in thread
From: Viktor Rosenfeld @ 2013-03-04 21:06 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Harum Budi

Hi Eric,

Eric S Fraga wrote:

> Using org for this is easier than having to work with ledger
> comments.  I can also then include, in the org file, the specific ledger
> instantiations to get the kinds of reports I want and execute these with
> C-c C-c.  So, for instance, I have ledger reports on the current
> balances, the taxable income from any particular year, etc.

I just remembered that I do mix ledger and org-mode, as I also have
ledger source blocks to generate weekly and monthly reports. 

Going over you original reply, I was wondering how you add to blocks
such as <<expenses-car>> which you reference in your report statement.
Also, do you use capture templates for your expenses and how do you
reconcile your accounts without having a ledger file as your primary
data file?

Cheers,
Viktor

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Tips for using orgmode + ledger to record events?
  2013-03-04 21:06           ` Viktor Rosenfeld
@ 2013-03-05  8:44             ` Eric S Fraga
  2013-03-05 18:25               ` Viktor Rosenfeld
  0 siblings, 1 reply; 10+ messages in thread
From: Eric S Fraga @ 2013-03-05  8:44 UTC (permalink / raw)
  To: emacs-orgmode

Viktor Rosenfeld <listuser36@gmail.com> writes:

[...]

> Going over you original reply, I was wondering how you add to blocks
> such as <<expenses-car>> which you reference in your report statement.

Hi Viktor,

I have named blocks which I subsequently edit using =C-c '= which brings
up the block in Ledger mode.  By having everything within org, I can use
headline structure and tags to organise all the different blocks and
find them easily and quickly.

I have a structure such as this:

#+begin_src org
* finances
** expenses
*** credit cards
*** utilities
** income
*** pay
*** consultancy
** funds
*** savings account
*** chequing account
*** shares
** summaries
*** current balance
*** income tax
**** 2011-2012
#+end_src

The only issue, and for me it's a very minor one, is that a double entry
ledger system naturally means that many (most?) entries could go into
two different headlines above.  E.g. expenses are likely to take money
from one bank account or another; pay will go into a bank account;
etc.  For me, the bank entries are mostly about recording interest
income and the movement of funds from one account to another.

> Also, do you use capture templates for your expenses and how do you
> reconcile your accounts without having a ledger file as your primary
> data file?

I don't use capture templates; I manually enter the information.  I did
use to use capture but found it too clumsy for my setup (or I was never
able to suss out how to define the right capture templates).  I don't
reconcile using ledger.  I do reconciliation manually by visual
inspection.  Reconciliation is not a big issue for me.  My main use of
ledger is simply to keep track of where my money is (or isn't, as the
case may be ;-).

cheers,
eric
-- 
: Eric S Fraga, GnuPG: 0xC89193D8FFFCF67D
: in Emacs 24.3.50.1 and Org release_7.9.3f-1199-g3a0e55

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Tips for using orgmode + ledger to record events?
  2013-03-05  8:44             ` Eric S Fraga
@ 2013-03-05 18:25               ` Viktor Rosenfeld
  0 siblings, 0 replies; 10+ messages in thread
From: Viktor Rosenfeld @ 2013-03-05 18:25 UTC (permalink / raw)
  To: emacs-orgmode

Hi Eric,

thanks for explaining your structure.

Eric S Fraga wrote:
 
> I don't use capture templates; I manually enter the information.  I did
> use to use capture but found it too clumsy for my setup (or I was never
> able to suss out how to define the right capture templates).  I don't
> reconcile using ledger.  I do reconciliation manually by visual
> inspection.  Reconciliation is not a big issue for me.  My main use of
> ledger is simply to keep track of where my money is (or isn't, as the
> case may be ;-).

Reconcilation (using ledger-mode) is an important part of my
weekly/monthly workflow and I think you need an actual ledger file to do
it. I imagine that one can manually check the balances with the help of
a few reports, but I'm pretty satisfied with my current setup.

It's interesting that you found capture templates clumsy. I don't use
them right now, but was thinking about using them to record recurring
information. Right now, I do this manually each month while reconciling
my bank account.

Thanks again,
Viktor

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-03-05 18:36 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-27 10:29 Tips for using orgmode + ledger to record events? Harum Budi
2013-03-01  8:47 ` Eric S Fraga
2013-03-01 10:09   ` Harum Budi
2013-03-01 13:11     ` Eric S Fraga
2013-03-01 14:17       ` Jeffrey Brent McBeth
2013-03-01 20:13       ` Viktor Rosenfeld
2013-03-04  8:52         ` Eric S Fraga
2013-03-04 21:06           ` Viktor Rosenfeld
2013-03-05  8:44             ` Eric S Fraga
2013-03-05 18:25               ` Viktor Rosenfeld

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).