diff options
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | emacs.cc | 4 | ||||
-rw-r--r-- | ledger.el | 20 | ||||
-rw-r--r-- | parser.cc | 3 | ||||
-rw-r--r-- | textual.cc | 7 |
5 files changed, 18 insertions, 18 deletions
diff --git a/Makefile.am b/Makefile.am index 6208cd80..e9c6070a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -134,7 +134,7 @@ install-exec-hook: CFLAGS="$(CPPFLAGS) -I$(srcdir) $(libamounts_la_CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)" \ LDFLAGS="$(LDFLAGS) -L$(top_builddir) -L$(top_builddir)/.libs" \ ARCHFLAGS="$(ARCHFLAGS)" SRCDIR="$(srcdir)" \ - python setup.py install --prefix=$(prefix) + python setup.py install --prefix=$(prefix) --root=$(DESTDIR)/ endif @@ -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 << "\""; @@ -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))) @@ -183,6 +183,9 @@ unsigned int parse_ledger_data(config_t& config, 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); } VALIDATE(journal->valid()); @@ -432,7 +432,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(); @@ -447,6 +447,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') { @@ -621,7 +622,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 { @@ -634,6 +635,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]) { @@ -874,7 +876,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)) { |