From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric S Fraga Subject: Re: Personal accounting with emacs, org and...? Date: Thu, 22 Jul 2010 21:30:02 +0100 Message-ID: <87mxtjw985.wl%ucecesf@ucl.ac.uk> References: <20100722062629.GK14200@thinkpad.adamsinfoserv.com> <877hknlwbb.wl%ucecesf@ucl.ac.uk> <878w53fnu1.fsf@gmail.com> Reply-To: Eric S Fraga Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: multipart/mixed; boundary="Multipart_Thu_Jul_22_21:30:02_2010-1" Return-path: Received: from [140.186.70.92] (port=51900 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oc2PI-0001Jg-OY for emacs-orgmode@gnu.org; Thu, 22 Jul 2010 16:30:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oc2PH-0003Ts-8H for emacs-orgmode@gnu.org; Thu, 22 Jul 2010 16:30:16 -0400 Received: from vscane-b.ucl.ac.uk ([144.82.108.141]:33309) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oc2PH-0003TA-0G for emacs-orgmode@gnu.org; Thu, 22 Jul 2010 16:30:15 -0400 In-Reply-To: <878w53fnu1.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Eric Schulte Cc: emacs-orgmode@gnu.org --Multipart_Thu_Jul_22_21:30:02_2010-1 Content-Type: text/plain; charset=US-ASCII On Thu, 22 Jul 2010 10:06:30 -0700, "Eric Schulte" wrote: > > Eric S Fraga writes: > > > On Thu, 22 Jul 2010 01:26:29 -0500, Russell Adams wrote: > >> > >> On Thu, Jul 22, 2010 at 01:20:58AM -0500, Marcelo de Moraes Serpa wrote: > >> > Hey list, > >> > > >> > I was wondering if anyone out there manages his personal accounting > >> > with org. I never really managed my personal finances, but I think > >> > it's about time to know where my money comes from and where it is > >> > going (and where the leaks are :P). I would use something like > >> > lessaccounting.com, but I would rather integrate it into my > >> > orgmode-based PIM. Any ideas? > >> > >> I use John Wiegley's Ledger (of Remember fame), which is a CLI tool > >> that does reporting against plain text files. > >> > >> I do my expense reporting and business accounting in it. Very flexible > >> and because it is text based, I can use version control and emacs. > > > > and, with org-babel, you can place your ledger entries in an org > > file... I have a simple ob-ledger implementation which doesn't do > > tangling yet (as I don't yet know how to provide this level of > > support) but it does work for single blocks of ledger entries. > > Tangling does not require *any* language specific support. Since the > integration of Babel into Org-mode any type of code block should tangle > just fine. For example the following minimal org file tangles a code > block of the fictional /schulte/ language to a file "eric.sh" Yes, thanks, I figured this out on the way home (the advantage of a long commute is time to play!) before I got your email. The tangling works like a charm. What's even better is that ability to specify the tangle property as an org property which only affects code blocks within a certain heading! Fantastic. > It does look like there is fertile ground for Babel<->Ledger > integration. Attached is my simple, linux only, org-babel solution and an example org file which uses it. Note, I've still not had a chance to look at the ob-template in Worg so I'm sure my ob-ledger file could be improved... Thanks again all those who have contributed to babel! eric --Multipart_Thu_Jul_22_21:30:02_2010-1 Content-Type: text/plain; type=emacs-lisp; charset=US-ASCII Content-Disposition: attachment; filename="ob-ledger.el" Content-Transfer-Encoding: 7bit ;;; ob-ledger.el --- org-babel functions for ledger evaluation ;; Copyright (c) 2009 Eric S Fraga ;; based on code by ;; Copyright (C) 2009 Eric Schulte ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org ;; Version: 0.01 ;;; License: ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 3, or (at your option) ;; any later version. ;; ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. ;;; Commentary: ;; Org-Babel support for evaluating ledger entries. ;; ;; This differs from most standard languages in that ;; ;; 1) there is no such thing as a "session" in ledger ;; ;; 2) we are generally only going to return output from the leger program ;; ;; 3) we are adding the "cmdline" header argument ;; ;; 4) there are no variables ;;; Code: ;; (require 'org-babel) ;;(org-babel-add-interpreter "ledger") ;;(add-to-list 'org-babel-tangle-langs '("ledger" "ledger")) (defvar org-babel-default-header-args:ledger '((:results . "output") (:cmdline . "bal")) "Default arguments to use when evaluating a ledger source block.") (defun org-babel-execute:ledger (body params) "Execute a block of Ledger entries with org-babel. This function is called by `org-babel-execute-src-block'." (message "executing Ledger source code block") (let ((result-params (split-string (or (cdr (assoc :results params)) ""))) (cmdline (cdr (assoc :cmdline params))) (in-file (make-temp-file "org-babel-ledger")) (out-file (make-temp-file "org-babel-ledger-output")) ) (with-temp-file in-file (insert body)) (message (concat "ledger -f " in-file " " cmdline)) (with-output-to-string (shell-command (concat "ledger -f " in-file " " cmdline " > " out-file))) (with-temp-buffer (insert-file-contents out-file) (buffer-string)) )) (defun org-babel-prep-session:ledger (session params) (error "Ledger does not support sessions")) (provide 'ob-ledger) ;;; org-babel-ledger.el ends here --Multipart_Thu_Jul_22_21:30:02_2010-1 Content-Type: text/plain; charset=US-ASCII Content-Disposition: attachment Content-Transfer-Encoding: base64 CiogbGVkZ2VyIHRlc3QKKioqIGluY29tZSBhbmQgZXhwZW5zZXMKICAgIDpQUk9QRVJUSUVTOgog ICAgOnRhbmdsZTogICBhY2NvdW50LmxlZGdlcgogICAgOkVORDoKICAgIFRoZSBwcm9wZXJ0eSBm b3IgdGhpcyBoZWFkaW5nIHNwZWNpZmllcyB3aGVyZSB0aGUgdGFuZ2xlZCBvdXRwdXQgb2YKICAg IHRoZSBsZWRnZXIgY29kZSBibG9ja3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HNvIGdlbmVyYXRlIGEgbW9udGhseSByZWdpc3RlciBieSBleGVjdXRpbmcgdGhlIGZv bGxvd2luZzoKCiMrYmVnaW5fc3JjIGxlZGdlciA6Y21kbGluZSAtTSAtdyByZWcKIWluY2x1ZGUg L2hvbWUvdWNlY2VzZi9zL3Rlc3QvYWNjb3VudC5sZWRnZXIKIytlbmRfc3JjCgojK3Jlc3VsdHM6 CiMrYmVnaW5fZXhhbXBsZQoyMDEwLzAxLzAxICAtIDIwMTAvMDEvMzEgICAgICAgICAgICAgICAg ICAgICAgICBhc3NldHM6YmFuazpzYXZpbmdzICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgwqMxMzAwLjAwICAgICAgICAgICAgICDCozEzMDAuMDAKICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5jb21lOnN0YXJ0aW5nIGJhbGFuY2VzICAgICAg ICAgICAgICAgICAgICAgICAgICAgwqMtMTMwMC4wMCAgICAgICAgICAgICAgICAgICAgICAwCjIw MTAvMDcvMDEgIC0gMjAxMC8wNy8zMSAgICAgICAgICAgICAgICAgICAgICAgIGFzc2V0czpiYW5r OmNoZXF1aW5nICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgwqMxMDAuMDAgICAgICAg ICAgICAgICDCozEwMC4wMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICBhc3NldHM6YmFuazpzYXZpbmdzICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgIMKjMjUzLjUzICAgICAgICAgICAgICAgwqMzNTMuNTMKICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhwZW5zZXM6Zm9vZCAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICDCozE1MC4wMCAgICAgICAgICAgICAgIMKjNTAzLjUzCiAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4cGVuc2VzOnJl bnQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgwqM1MDAuMDAgICAgICAg ICAgICAgIMKjMTAwMy41MwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICBpbmNvbWU6aW50ZXJlc3QgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICDCoy0zLjUzICAgICAgICAgICAgICDCozEwMDAuMDAKICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5jb21lOnNhbGFyeSAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgwqMtMTAwMC4wMCAgICAgICAgICAgICAgICAgICAgICAwCjIw MTAvMDgvMDEgIC0gMjAxMC8wOC8wMSAgICAgICAgICAgICAgICAgICAgICAgIGFzc2V0czpiYW5r OmNoZXF1aW5nICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICDCozEwMDAuMDAgICAgICAg ICAgICAgIMKjMTAwMC4wMAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICBpbmNvbWU6c2FsYXJ5ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICDCoy0xMDAwLjAwICAgICAgICAgICAgICAgICAgICAgIDAKIytlbmRfZXhhbXBsZQoK --Multipart_Thu_Jul_22_21:30:02_2010-1 Content-Type: text/plain; charset=US-ASCII -- Eric S Fraga GnuPG: 8F5C 279D 3907 E14A 5C29 570D C891 93D8 FFFC F67D --Multipart_Thu_Jul_22_21:30:02_2010-1 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --Multipart_Thu_Jul_22_21:30:02_2010-1--