summaryrefslogtreecommitdiff
path: root/src/emacs.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2010-06-02 01:55:55 -0400
committerJohn Wiegley <johnw@newartisans.com>2010-06-02 01:55:55 -0400
commitcda19829bd1100d6563b48ddb121f2afc1c55d95 (patch)
tree5b6ab0d1eb7ec1b0b3eccf817678d0aa9a3feb47 /src/emacs.cc
parent017492ef5e80003073c5d053252d4a68a44260ae (diff)
parentfb7cafa8965c89bbd66b09f827bd5989a87c983b (diff)
downloadledger-cda19829bd1100d6563b48ddb121f2afc1c55d95.tar.gz
ledger-cda19829bd1100d6563b48ddb121f2afc1c55d95.tar.bz2
ledger-cda19829bd1100d6563b48ddb121f2afc1c55d95.zip
Merge branch 'next'
Diffstat (limited to 'src/emacs.cc')
-rw-r--r--src/emacs.cc19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/emacs.cc b/src/emacs.cc
index d47f04ad..3c8bb256 100644
--- a/src/emacs.cc
+++ b/src/emacs.cc
@@ -40,18 +40,21 @@ namespace ledger {
void format_emacs_posts::write_xact(xact_t& xact)
{
- out << "\"" << xact.pos->pathname << "\" "
- << xact.pos->beg_line << " ";
+ if (xact.pos)
+ out << "\"" << xact.pos->pathname << "\" "
+ << xact.pos->beg_line << " ";
+ else
+ out << "\"\" " << -1 << " ";
tm when = gregorian::to_tm(xact.date());
std::time_t date = std::mktime(&when);
out << "(" << (date / 65536) << " " << (date % 65536) << " 0) ";
- if (! xact.code)
- out << "nil ";
- else
+ if (xact.code)
out << "\"" << *xact.code << "\" ";
+ else
+ out << "nil ";
if (xact.payee.empty())
out << "nil";
@@ -77,7 +80,11 @@ void format_emacs_posts::operator()(post_t& post)
out << "\n";
}
- out << " (" << post.pos->beg_line << " ";
+ if (post.pos)
+ out << " (" << post.pos->beg_line << " ";
+ else
+ out << " (" << -1 << " ";
+
out << "\"" << post.reported_account()->fullname() << "\" \""
<< post.amount << "\"";