From 7dfa17b2602a424ab0d8f137ea0fc9005cdf8f84 Mon Sep 17 00:00:00 2001 From: Levin Du Date: Tue, 29 Jul 2008 12:39:17 +0800 Subject: [PATCH 1/4] add --root option to python module build --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index bb483b26..a9041354 100644 --- a/Makefile.am +++ b/Makefile.am @@ -124,7 +124,7 @@ amounts.so: amounts.cc libamounts.la install-exec-hook: CFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS) -L. -L.libs" \ - python setup.py install --prefix=$(prefix) + python setup.py install --prefix=$(prefix) --root=$(DESTDIR)/ endif From bffdc6431d86a3f483c1fc2708526cae28d39f4b Mon Sep 17 00:00:00 2001 From: Levin Du Date: Tue, 29 Jul 2008 17:37:35 +0800 Subject: [PATCH 2/4] fix beg_line bug --- emacs.cc | 4 ++-- textual.cc | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/emacs.cc b/emacs.cc index ed0674a2..7551b37c 100644 --- a/emacs.cc +++ b/emacs.cc @@ -13,7 +13,7 @@ void format_emacs_transactions::write_entry(entry_t& entry) break; } - out << (((unsigned long)entry.beg_line) + 1) << " "; + out << ((unsigned long)entry.beg_line) << " "; std::time_t date = entry.date().when; out << "(" << (date / 65536) << " " << (date % 65536) << " 0) "; @@ -47,7 +47,7 @@ void format_emacs_transactions::operator()(transaction_t& xact) out << "\n"; } - out << " (" << (((unsigned long)xact.beg_line) + 1) << " "; + out << " (" << ((unsigned long)xact.beg_line) << " "; out << "\"" << xact_account(xact)->fullname() << "\" \"" << xact.amount << "\""; diff --git a/textual.cc b/textual.cc index 9ac018fa..46d6d8aa 100644 --- a/textual.cc +++ b/textual.cc @@ -509,7 +509,7 @@ entry_t * parse_entry(std::istream& in, char * line, account_t * master, TIMER_START(entry_xacts); unsigned long end_pos; - unsigned long beg_line = linenum; + unsigned long beg_line; while (! in.eof() && (in.peek() == ' ' || in.peek() == '\t')) { unsigned long beg_pos = (unsigned long)in.tellg(); @@ -524,6 +524,7 @@ entry_t * parse_entry(std::istream& in, char * line, account_t * master, line[--len] = '\0'; end_pos = beg_pos + len + 1; + beg_line = linenum; linenum++; if (line[0] == ' ' || line[0] == '\t') { @@ -698,7 +699,7 @@ unsigned int textual_parser_t::parse(std::istream& in, unsigned long beg_pos = in.tellg(); unsigned long end_pos; - unsigned long beg_line = linenum; + unsigned long beg_line; while (in.good() && ! in.eof()) { try { @@ -711,6 +712,7 @@ unsigned int textual_parser_t::parse(std::istream& in, line[--len] = '\0'; end_pos = beg_pos + len + 1; + beg_line = linenum; linenum++; switch (line[0]) { @@ -951,7 +953,6 @@ unsigned int textual_parser_t::parse(std::istream& in, } default: { - unsigned int first_line = linenum; unsigned long pos = beg_pos; if (entry_t * entry = parse_entry(in, line, account_stack.front(), *this, pos)) { From 19fcf4c99d0647e19b75f5f95a23bfc9c15ebd61 Mon Sep 17 00:00:00 2001 From: Levin Du Date: Thu, 31 Jul 2008 14:13:09 +0800 Subject: [PATCH 3/4] fix balance error if read from stdin This is introduce by c93175183e790cf7f1100dfd554197161a69e6fe --- parser.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/parser.cc b/parser.cc index c96f2435..debe5558 100644 --- a/parser.cc +++ b/parser.cc @@ -182,11 +182,10 @@ unsigned int parse_ledger_data(config_t& config, journal, acct); if (! journal->price_db.empty()) journal->sources.push_back(journal->price_db); - - // Clear out what was set during the textual parsing phase - clear_account_xdata acct_cleaner; - walk_accounts(*journal->master, acct_cleaner); } + // Clear out what was set during the textual parsing phase + clear_account_xdata acct_cleaner; + walk_accounts(*journal->master, acct_cleaner); } VALIDATE(journal->valid()); From 37cf3c6f6e54de338a5d16e0ff7a62754533fe22 Mon Sep 17 00:00:00 2001 From: Levin Du Date: Thu, 31 Jul 2008 16:08:16 +0800 Subject: [PATCH 4/4] ledger.el: fix broken ledger reconcile --- ledger.el | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/ledger.el b/ledger.el index abdefdfb..6262ec94 100644 --- a/ledger.el +++ b/ledger.el @@ -510,14 +510,14 @@ dropped." (unless (looking-at "[0-9]") (error (buffer-string))) (while (not (eobp)) - (setq cleared - (cons (save-excursion - (goto-line (1+ (read (current-buffer)))) - (point-marker)) cleared)) + (push (read (current-buffer)) cleared) (forward-line))))) (goto-char (point-min)) (with-current-buffer ledger-buf - (setq cleared (mapcar 'copy-marker (nreverse cleared)))) + (setq cleared (mapcar (lambda (line) + (goto-line line) + (point-marker)) + (nreverse cleared)))) (let ((inhibit-redisplay t)) (dolist (pos cleared) (while (and (not (eobp)) @@ -616,13 +616,9 @@ dropped." (with-current-buffer buf (cons (nth 0 item) - (if ledger-clear-whole-entries - (save-excursion - (goto-line (nth 1 item)) - (point-marker)) - (save-excursion - (goto-line (nth 0 xact)) - (point-marker))))))) + (save-excursion + (goto-line (nth 0 xact)) + (point-marker)))))) (insert (format "%s %-30s %-25s %15s\n" (format-time-string "%m/%d" (nth 2 item)) (nth 4 item) (nth 1 xact) (nth 2 xact)))