summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@fpcomplete.com>2013-01-16 17:50:31 -0600
committerJohn Wiegley <johnw@fpcomplete.com>2013-01-16 17:50:31 -0600
commit24b791ad078e36cfd8f895544636320467aa70ce (patch)
tree3ad7f3dda601512170ed152f8f02003a3d217f4c /lisp
parent23483b7973f3db45cace4ff9529daed54a0059c6 (diff)
downloadfork-ledger-24b791ad078e36cfd8f895544636320467aa70ce.tar.gz
fork-ledger-24b791ad078e36cfd8f895544636320467aa70ce.tar.bz2
fork-ledger-24b791ad078e36cfd8f895544636320467aa70ce.zip
Apply patch to update ldg-reconcile.el
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ldg-reconcile.el40
1 files changed, 39 insertions, 1 deletions
diff --git a/lisp/ldg-reconcile.el b/lisp/ldg-reconcile.el
index baeadc33..d3dda60f 100644
--- a/lisp/ldg-reconcile.el
+++ b/lisp/ldg-reconcile.el
@@ -105,7 +105,45 @@
(ledger-reconcile-save))
(defun ledger-do-reconcile ()
- )
+ (let* ((buf ledger-buf)
+ (account ledger-acct)
+ (items
+ (with-current-buffer
+ (apply #'ledger-exec-ledger
+ buf nil "emacs" account "--uncleared" '("--real"))
+ (goto-char (point-min))
+ (unless (eobp)
+ (unless (looking-at "(")
+ (error (buffer-string)))
+ (read (current-buffer))))))
+ (dolist (item items)
+ (let ((index 1))
+ (dolist (xact (nthcdr 5 item))
+ (let ((beg (point))
+ (where
+ (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)))))))
+ (insert (format "%s %-30s %-25s %15s\n"
+ (format-time-string "%m/%d" (nth 2 item))
+ (nth 4 item) (nth 1 xact) (nth 2 xact)))
+ (if (nth 3 xact)
+ (set-text-properties beg (1- (point))
+ (list 'face 'bold
+ 'where where))
+ (set-text-properties beg (1- (point))
+ (list 'where where))))
+ (setq index (1+ index)))))
+ (goto-char (point-min))
+ (set-buffer-modified-p nil)
+ (toggle-read-only t)))
(defun ledger-reconcile (account)
(interactive "sAccount to reconcile: ")