From 2df14a5b86371cd8008c72f9d16421c1a404a4a8 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Thu, 16 Feb 2006 21:10:50 +0000 Subject: 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. --- ledger.el | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) (limited to 'ledger.el') 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)) -- cgit v1.2.3