Merge branch git://github.com/levindu/ledger.git 'master' into v2.6.1b

Conflicts:
	Makefile.am
This commit is contained in:
John Wiegley 2008-08-26 10:10:16 -04:00
commit 00ca034e73
5 changed files with 18 additions and 18 deletions

View file

@ -134,7 +134,7 @@ install-exec-hook:
CFLAGS="$(CPPFLAGS) -I$(srcdir) $(libamounts_la_CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)" \ CFLAGS="$(CPPFLAGS) -I$(srcdir) $(libamounts_la_CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)" \
LDFLAGS="$(LDFLAGS) -L$(top_builddir) -L$(top_builddir)/.libs" \ LDFLAGS="$(LDFLAGS) -L$(top_builddir) -L$(top_builddir)/.libs" \
ARCHFLAGS="$(ARCHFLAGS)" SRCDIR="$(srcdir)" \ ARCHFLAGS="$(ARCHFLAGS)" SRCDIR="$(srcdir)" \
python setup.py install --prefix=$(prefix) python setup.py install --prefix=$(prefix) --root=$(DESTDIR)/
endif endif

View file

@ -13,7 +13,7 @@ void format_emacs_transactions::write_entry(entry_t& entry)
break; break;
} }
out << (((unsigned long)entry.beg_line) + 1) << " "; out << ((unsigned long)entry.beg_line) << " ";
std::time_t date = entry.date().when; std::time_t date = entry.date().when;
out << "(" << (date / 65536) << " " << (date % 65536) << " 0) "; out << "(" << (date / 65536) << " " << (date % 65536) << " 0) ";
@ -47,7 +47,7 @@ void format_emacs_transactions::operator()(transaction_t& xact)
out << "\n"; out << "\n";
} }
out << " (" << (((unsigned long)xact.beg_line) + 1) << " "; out << " (" << ((unsigned long)xact.beg_line) << " ";
out << "\"" << xact_account(xact)->fullname() << "\" \"" out << "\"" << xact_account(xact)->fullname() << "\" \""
<< xact.amount << "\""; << xact.amount << "\"";

View file

@ -510,14 +510,14 @@ dropped."
(unless (looking-at "[0-9]") (unless (looking-at "[0-9]")
(error (buffer-string))) (error (buffer-string)))
(while (not (eobp)) (while (not (eobp))
(setq cleared (push (read (current-buffer)) cleared)
(cons (save-excursion
(goto-line (1+ (read (current-buffer))))
(point-marker)) cleared))
(forward-line))))) (forward-line)))))
(goto-char (point-min)) (goto-char (point-min))
(with-current-buffer ledger-buf (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)) (let ((inhibit-redisplay t))
(dolist (pos cleared) (dolist (pos cleared)
(while (and (not (eobp)) (while (and (not (eobp))
@ -616,13 +616,9 @@ dropped."
(with-current-buffer buf (with-current-buffer buf
(cons (cons
(nth 0 item) (nth 0 item)
(if ledger-clear-whole-entries (save-excursion
(save-excursion (goto-line (nth 0 xact))
(goto-line (nth 1 item)) (point-marker))))))
(point-marker))
(save-excursion
(goto-line (nth 0 xact))
(point-marker)))))))
(insert (format "%s %-30s %-25s %15s\n" (insert (format "%s %-30s %-25s %15s\n"
(format-time-string "%m/%d" (nth 2 item)) (format-time-string "%m/%d" (nth 2 item))
(nth 4 item) (nth 1 xact) (nth 2 xact))) (nth 4 item) (nth 1 xact) (nth 2 xact)))

View file

@ -183,6 +183,9 @@ unsigned int parse_ledger_data(config_t& config,
if (! journal->price_db.empty()) if (! journal->price_db.empty())
journal->sources.push_back(journal->price_db); 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()); VALIDATE(journal->valid());

View file

@ -432,7 +432,7 @@ entry_t * parse_entry(std::istream& in, char * line, account_t * master,
TIMER_START(entry_xacts); TIMER_START(entry_xacts);
unsigned long end_pos; unsigned long end_pos;
unsigned long beg_line = linenum; unsigned long beg_line;
while (! in.eof() && (in.peek() == ' ' || in.peek() == '\t')) { while (! in.eof() && (in.peek() == ' ' || in.peek() == '\t')) {
unsigned long beg_pos = (unsigned long)in.tellg(); 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'; line[--len] = '\0';
end_pos = beg_pos + len + 1; end_pos = beg_pos + len + 1;
beg_line = linenum;
linenum++; linenum++;
if (line[0] == ' ' || line[0] == '\t') { 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 beg_pos = in.tellg();
unsigned long end_pos; unsigned long end_pos;
unsigned long beg_line = linenum; unsigned long beg_line;
while (in.good() && ! in.eof()) { while (in.good() && ! in.eof()) {
try { try {
@ -634,6 +635,7 @@ unsigned int textual_parser_t::parse(std::istream& in,
line[--len] = '\0'; line[--len] = '\0';
end_pos = beg_pos + len + 1; end_pos = beg_pos + len + 1;
beg_line = linenum;
linenum++; linenum++;
switch (line[0]) { switch (line[0]) {
@ -874,7 +876,6 @@ unsigned int textual_parser_t::parse(std::istream& in,
} }
default: { default: {
unsigned int first_line = linenum;
unsigned long pos = beg_pos; unsigned long pos = beg_pos;
if (entry_t * entry = if (entry_t * entry =
parse_entry(in, line, account_stack.front(), *this, pos)) { parse_entry(in, line, account_stack.front(), *this, pos)) {