summaryrefslogtreecommitdiff
path: root/emacs.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2005-02-09 21:07:11 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 02:40:56 -0400
commit9618057215eb7638475a4299b81cbdca8e1f4e3f (patch)
treea70fe046b2245aca9d2c0a2f75dd0e5ef04fb515 /emacs.h
parentf2390964cb22494b78674d02fa542a9116d10f0b (diff)
downloadfork-ledger-9618057215eb7638475a4299b81cbdca8e1f4e3f.tar.gz
fork-ledger-9618057215eb7638475a4299b81cbdca8e1f4e3f.tar.bz2
fork-ledger-9618057215eb7638475a4299b81cbdca8e1f4e3f.zip
Added an Emacs formatter, accessible with the new "emacs" command.
Diffstat (limited to 'emacs.h')
-rw-r--r--emacs.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/emacs.h b/emacs.h
new file mode 100644
index 00000000..ea58bad8
--- /dev/null
+++ b/emacs.h
@@ -0,0 +1,30 @@
+#ifndef _EMACS_H
+#define _EMACS_H
+
+#include "journal.h"
+#include "format.h"
+
+namespace ledger {
+
+class format_emacs_transactions : public item_handler<transaction_t>
+{
+ protected:
+ std::ostream& out;
+ entry_t * last_entry;
+
+ public:
+ format_emacs_transactions(std::ostream& _out)
+ : out(_out), last_entry(NULL) {}
+
+ virtual void write_entry(entry_t& entry);
+ virtual void flush() {
+ if (last_entry)
+ out << "))\n";
+ out.flush();
+ }
+ virtual void operator()(transaction_t& xact);
+};
+
+} // namespace ledger
+
+#endif // _REPORT_H