summaryrefslogtreecommitdiff
path: root/ledger.el
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2006-02-16 21:10:50 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 02:41:24 -0400
commit2df14a5b86371cd8008c72f9d16421c1a404a4a8 (patch)
tree247b3e1f9628fd62e19f0758d8f7265308b1d8e2 /ledger.el
parent085420dd28802b8b5962c785dd31e0c28571147d (diff)
downloadfork-ledger-2df14a5b86371cd8008c72f9d16421c1a404a4a8.tar.gz
fork-ledger-2df14a5b86371cd8008c72f9d16421c1a404a4a8.tar.bz2
fork-ledger-2df14a5b86371cd8008c72f9d16421c1a404a4a8.zip
Transactions now track their beginning and ending position, as do
entries. The new format strings %xB %xE %xb %xe can be used to display those values relative to a transaction. The Emacs module now relies on this support to exactly determine where a transaction is, rather than the Elisp logic it relied on previously.
Diffstat (limited to 'ledger.el')
-rw-r--r--ledger.el25
1 files changed, 6 insertions, 19 deletions
diff --git a/ledger.el b/ledger.el
index 70f38b1e..cdea2009 100644
--- a/ledger.el
+++ b/ledger.el
@@ -372,15 +372,9 @@ dropped."
;; attempt to auto-reconcile in the background
(with-temp-buffer
(let ((exit-code
- (ledger-run-ledger
- buffer "--format" "%B\\n" "--reconcile"
- (with-temp-buffer
- (insert balance)
- (goto-char (point-min))
- (while (re-search-forward "\\([&$]\\)" nil t)
- (replace-match "\\\\\\1"))
- (buffer-string))
- "--reconcile-date" date "register" account)))
+ (ledger-run-ledger buffer "--format" "%xB\\n"
+ "--reconcile" balance "--reconcile-date" date
+ "register" account)))
(if (/= 0 exit-code)
(error "Failed to reconcile account '%s' to balance '%s'"
account balance)
@@ -494,18 +488,11 @@ dropped."
(nth 0 item)
(if ledger-clear-whole-entries
(copy-marker (nth 1 item))
- (save-excursion
- (goto-char (nth 1 item))
- (let ((i 0))
- (while (< i index)
- (re-search-forward
- account (cdr (ledger-current-entry-bounds)))
- (setq i (1+ i))))
- (point-marker)))))))
+ (copy-marker (nth 0 xact)))))))
(insert (format "%s %-30s %-25s %15s\n"
(format-time-string "%m/%d" (nth 2 item))
- (nth 4 item) (nth 0 xact) (nth 1 xact)))
- (if (nth 2 xact)
+ (nth 4 item) (nth 1 xact) (nth 2 xact)))
+ (if (nth 3 xact)
(set-text-properties beg (1- (point))
(list 'face 'bold
'where where))