A feature idea: An alternative org-mode input format

55 views
Skip to first unread message

John Wiegley

unread,
Feb 9, 2023, 2:41:06 PM2/9/23
to ledge...@googlegroups.com
Hi all,

I was thinking of creating a separate tool for translating specially formatted
Org-mode files into Ledger files. For example, this entry:

2023-01-10 Adobe Acrobat Pro
; ID: 076497DC-45F7-43EC-BFDA-00177EFC3C0D
; CREATED: [2023-01-25 Wed 21:40]
Expenses:Administrative $33.59
Equity:Admin:Somebody

Would be processed from this Org-mode entry:

* [2023-01-10 Tue] Adobe Acrobat Pro
| Expenses:Administrative | $33.59 |
| Equity:Admin:Somebody | |
:PROPERTIES:
:ID: 076497DC-45F7-43EC-BFDA-00177EFC3C0D
:CREATED: [2023-01-25 Wed 21:40]
:END:

Now, why might you want to record Ledger entry in Org-mode? Because you get
these added benefits:

- Org-mode's hierarchical organization, narrowing, searching, filtering
- Org-mode tags become Ledger tags for the whole transaction
- Org-mode properties become Ledger metadata for the whole transaction
- You can use Org-attach to attach files to entries
- You can use cross-linking to jump between entries
- You can use the agenda and calendar to review entries on given dates

There's already a Haskell library for parsing Org-mode files, so I was
thinking that building this as a UNIX tool shouldn't be but a few days work.
It would be run as follows:

org2ledger ledger.org | ledger -f - reg

John

Alexandre Rademaker

unread,
Feb 9, 2023, 9:32:07 PM2/9/23
to ledge...@googlegroups.com

The table would be just a normal content, right? Is the format below more regular for org-mode?

* [2023-01-10 Tue] Adobe Acrobat Pro
:PROPERTIES:
:ID: 076497DC-45F7-43EC-BFDA-00177EFC3C0D
:CREATED: [2023-01-25 Wed 21:40]
:END:

| Expenses:Administrative | $33.59 |
| Equity:Admin:Somebody | |


I am curious about the use cases for the benefits you described.

Best,
Alexandre

MC Mabele

unread,
Feb 10, 2023, 12:57:02 AM2/10/23
to ledge...@googlegroups.com
Hi John,

I’m a heavy user of org. This tool would be cool.

Regards,


Sent from my iPhone

> On Feb 9, 2023, at 9:41 PM, John Wiegley <jwie...@gmail.com> wrote:
>
> Hi all,
> --
>
> ---
> You received this message because you are subscribed to the Google Groups "Ledger" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ledger-cli/m2ilga4ofw.fsf%40newartisans.com.

Marcin Borkowski

unread,
Feb 10, 2023, 1:41:30 AM2/10/23
to ledge...@googlegroups.com

On 2023-02-10, at 03:31, Alexandre Rademaker <arade...@gmail.com> wrote:

> The table would be just a normal content, right? Is the format below more regular for org-mode?
>
> * [2023-01-10 Tue] Adobe Acrobat Pro
> :PROPERTIES:
> :ID: 076497DC-45F7-43EC-BFDA-00177EFC3C0D
> :CREATED: [2023-01-25 Wed 21:40]
> :END:
>
> | Expenses:Administrative | $33.59 |
> | Equity:Admin:Somebody | |
>
>
> I am curious about the use cases for the benefits you described.

Another thing you could easily do would be to use org-capture with this.

Best,

--
Marcin Borkowski
http://mbork.pl

Eric S Fraga

unread,
Feb 10, 2023, 5:43:02 AM2/10/23
to ledge...@googlegroups.com
On Thursday, 9 Feb 2023 at 11:40, John Wiegley wrote:
> I was thinking of creating a separate tool for translating specially formatted
> Org-mode files into Ledger files. For example, this entry:

Why not just use ob-ledger? Then your entry would look like

--8<---------------cut here---------------start------------->8---
#+PROPERTY: header-args:ledger :tangle ledgerfile

* Adobe Acrobat Pro
:PROPERTIES:
:ID: 076497DC-45F7-43EC-BFDA-00177EFC3C0D
:CREATED: [2023-01-25 Wed 21:40]
:END:
#+begin_src ledger
2023-01-10 Adobe Acrobat Pro
Expenses:Administrative $33.59
Equity:Admin:Somebody
#+end_src
--8<---------------cut here---------------end--------------->8---

The only negative aspect would be having to repeat the description of
the entry.

Tangling would create the ledgerfile which you can then process using
other babel src blocks or directly with ledger on the command line.

--
Eric S Fraga via gnus (Emacs 30.0.50 2023-01-06) on Debian 11.5

Boyd Kelly

unread,
Feb 10, 2023, 2:52:42 PM2/10/23
to ledge...@googlegroups.com
Maybe then a use case would be to use the orgzly android app to enter ledger transactions on mobile. 
There is a lack of mobile tools....

--

---
You received this message because you are subscribed to the Google Groups "Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+...@googlegroups.com.


--
Reply all
Reply to author
Forward
0 new messages