From 7dea4f2c80d910c29683b4699d2e02ea7d0629b9 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Tue, 15 Feb 2005 10:23:29 +0000 Subject: *** empty log message *** --- emacs.py | 53 ----------------------------------------------------- 1 file changed, 53 deletions(-) delete mode 100644 emacs.py (limited to 'emacs.py') 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 -- cgit v1.2.3