Reconciling using ledger.el is now line-based, instead of character based, due
to problems with UTF-8 characters.
This commit is contained in:
parent
0f7776f7af
commit
899f79d032
2 changed files with 13 additions and 7 deletions
6
emacs.cc
6
emacs.cc
|
|
@ -13,9 +13,9 @@ void format_emacs_transactions::write_entry(entry_t& entry)
|
|||
break;
|
||||
}
|
||||
|
||||
out << (((unsigned long)entry.beg_pos) + 1) << " ";
|
||||
out << (((unsigned long)entry.beg_line) + 1) << " ";
|
||||
|
||||
std::time_t date = entry.date();
|
||||
std::time_t date = entry.date().when;
|
||||
out << "(" << (date / 65536) << " " << (date % 65536) << " 0) ";
|
||||
|
||||
if (entry.code.empty())
|
||||
|
|
@ -47,7 +47,7 @@ void format_emacs_transactions::operator()(transaction_t& xact)
|
|||
out << "\n";
|
||||
}
|
||||
|
||||
out << " (" << (((unsigned long)xact.beg_pos) + 1) << " ";
|
||||
out << " (" << (((unsigned long)xact.beg_line) + 1) << " ";
|
||||
out << "\"" << xact_account(xact)->fullname() << "\" \""
|
||||
<< xact.amount << "\"";
|
||||
|
||||
|
|
|
|||
14
ledger.el
14
ledger.el
|
|
@ -416,7 +416,7 @@ dropped."
|
|||
;; attempt to auto-reconcile in the background
|
||||
(with-temp-buffer
|
||||
(let ((exit-code
|
||||
(ledger-run-ledger buffer "--format" "%xB\\n"
|
||||
(ledger-run-ledger buffer "--format" "%xb\\n"
|
||||
"--reconcile" balance "--reconcile-date" date
|
||||
"register" account)))
|
||||
(if (/= 0 exit-code)
|
||||
|
|
@ -427,7 +427,9 @@ dropped."
|
|||
(error (buffer-string)))
|
||||
(while (not (eobp))
|
||||
(setq cleared
|
||||
(cons (1+ (read (current-buffer))) cleared))
|
||||
(cons (save-excursion
|
||||
(goto-line (1+ (read (current-buffer))))
|
||||
(point-marker)) cleared))
|
||||
(forward-line)))))
|
||||
(goto-char (point-min))
|
||||
(with-current-buffer ledger-buf
|
||||
|
|
@ -531,8 +533,12 @@ dropped."
|
|||
(cons
|
||||
(nth 0 item)
|
||||
(if ledger-clear-whole-entries
|
||||
(copy-marker (nth 1 item))
|
||||
(copy-marker (nth 0 xact)))))))
|
||||
(save-excursion
|
||||
(goto-line (nth 1 item))
|
||||
(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)))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue