diff options
author | John Wiegley <johnw@newartisans.com> | 2005-02-15 10:23:29 +0000 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-04-13 02:41:01 -0400 |
commit | 7dea4f2c80d910c29683b4699d2e02ea7d0629b9 (patch) | |
tree | a7acbbb18ff7f5d5fdb8bc689ac02ebc73ac20e4 /emacs.py | |
parent | 11dc5b17d8b0bdfa6321adb771b8329290ddc139 (diff) | |
download | fork-ledger-7dea4f2c80d910c29683b4699d2e02ea7d0629b9.tar.gz fork-ledger-7dea4f2c80d910c29683b4699d2e02ea7d0629b9.tar.bz2 fork-ledger-7dea4f2c80d910c29683b4699d2e02ea7d0629b9.zip |
*** empty log message ***
Diffstat (limited to 'emacs.py')
-rw-r--r-- | emacs.py | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/emacs.py b/emacs.py deleted file mode 100644 index 3398ec9c..00000000 --- a/emacs.py +++ /dev/null @@ -1,53 +0,0 @@ -import sys - -from ledger import * - -def emacs_date (seconds): - return "(%d %d %d)" % (seconds / 65536, seconds % 65536, 0) - -class EmacsFormatTransactions (TransactionHandler): - last_entry = None - output = None - - def __init__ (self): - self.last_entry = None - - if config.output_file: - self.output = open (config.output_file, "w") - else: - self.output = sys.stdout - - TransactionHandler.__init__ (self) - - def __del__ (self): - if config.output_file: - self.output.close () - - def flush (self): - self.output.write ("))\n") - self.output.flush () - - def write_entry (self, entry): - self.output.write("%s %s %s %s\n" % - (emacs_date (entry.date), - (entry.state and "t") or "nil", - (entry.code and "\"%s\"" % entry.code) or "nil", - (entry.payee and "\"%s\"" % entry.payee) or "nil")) - - def __call__ (self, xact): - if not transaction_has_xdata (xact) or \ - not transaction_xdata (xact).dflags & TRANSACTION_DISPLAYED: - if self.last_entry is None: - self.output.write("((") - self.write_entry (xact.entry) - elif xact.entry != self.last_entry: - self.output.write(")\n (") - self.write_entry (xact.entry) - else: - self.output.write("\n") - self.output.write(" (\"%s\" \"%s\"%s%s)" % - (xact.account.fullname (), xact.amount, - (xact.cost and " \"%s\"" % xact.cost) or "", - (xact.note and " \"%s\"" % xact.note) or "")) - self.last_entry = xact.entry - transaction_xdata (xact).dflags |= TRANSACTION_DISPLAYED |