summaryrefslogtreecommitdiff
path: root/lisp/ldg-reconcile.el
diff options
context:
space:
mode:
authorCraig Earls <enderw88@gmail.com>2013-02-13 13:23:04 -0700
committerCraig Earls <enderw88@gmail.com>2013-02-13 13:23:04 -0700
commit15d838d1f86b41e303e392d78eaac970311594cb (patch)
tree2d6eeb454f11619d027871b858e9b2c59e70cfcc /lisp/ldg-reconcile.el
parent6315c60e43e62397a8c5396ea1f591b61ea6fcdb (diff)
downloadfork-ledger-15d838d1f86b41e303e392d78eaac970311594cb.tar.gz
fork-ledger-15d838d1f86b41e303e392d78eaac970311594cb.tar.bz2
fork-ledger-15d838d1f86b41e303e392d78eaac970311594cb.zip
Bug 893 Ledger reconcile loses alignment
An earlier change to multi-file support stored the actual markers to the beginnings of the transaction/postings. When reconcile would insert characters it would invalidate those marker and after many items and been cleared could result in severe misalignment. This change brings back storing the line-numbers as reported by emacs.
Diffstat (limited to 'lisp/ldg-reconcile.el')
-rw-r--r--lisp/ldg-reconcile.el28
1 files changed, 13 insertions, 15 deletions
diff --git a/lisp/ldg-reconcile.el b/lisp/ldg-reconcile.el
index 822597f7..63ea522b 100644
--- a/lisp/ldg-reconcile.el
+++ b/lisp/ldg-reconcile.el
@@ -60,11 +60,11 @@
(let ((buffer ledger-buf)
(account ledger-acct))
(with-temp-buffer
- (ledger-exec-ledger buffer (current-buffer) "-C" "balance" account)
+ (ledger-exec-ledger buffer (current-buffer) "balance" "--limit" "cleared or pending" account)
(goto-char (1- (point-max)))
(goto-char (line-beginning-position))
(delete-horizontal-space)
- (message "Cleared balance = %s"
+ (message "Current pending balance = %s"
(buffer-substring-no-properties (point)
(line-end-position))))))
@@ -87,7 +87,8 @@
status)
(when (ledger-reconcile-get-buffer where)
(with-current-buffer (ledger-reconcile-get-buffer where)
- (goto-char (cdr where))
+ (ledger-goto-line (cdr where))
+ (forward-char)
(setq status (ledger-toggle-current (if ledger-reconcile-toggle-to-pending
'pending
'cleared))))
@@ -139,7 +140,7 @@
(let ((where (get-text-property (point) 'where)))
(when (ledger-reconcile-get-buffer where)
(with-current-buffer (ledger-reconcile-get-buffer where)
- (goto-char (cdr where))
+ (ledger-goto-line (cdr where))
(ledger-delete-current-transaction))
(let ((inhibit-read-only t))
(goto-char (line-beginning-position))
@@ -157,7 +158,8 @@
(cur-buf (get-buffer ledger-recon-buffer-name)))
(when target-buffer
(switch-to-buffer-other-window target-buffer)
- (goto-char (cdr where))
+ (ledger-goto-line (cdr where))
+ (forward-char)
(recenter)
(ledger-highlight-xact-under-point)
(if come-back
@@ -183,7 +185,7 @@
(face (get-text-property (point) 'face)))
(if (eq face 'ledger-font-reconciler-pending-face)
(with-current-buffer (ledger-reconcile-get-buffer where)
- (goto-char (cdr where))
+ (ledger-goto-line (cdr where))
(ledger-toggle-current 'cleared))))
(forward-line 1)))
(ledger-reconcile-save))
@@ -217,15 +219,11 @@
(let ((buf (if (is-stdin (nth 0 emacs-xact))
ledger-buf
(find-file-noselect (nth 0 emacs-xact)))))
- (with-current-buffer buf
- (cons
- buf
- (save-excursion
- (if ledger-clear-whole-transactions
- (goto-line (nth 1 emacs-xact))
- (goto-line (nth 0 posting)))
- (1+ (point-marker))))))) ;;Add 1 to make sure the marker is
- ;;within the transaction
+ (cons
+ buf
+ (if ledger-clear-whole-transactions
+ (nth 1 emacs-xact) ;; return line-no of xact
+ (nth 0 posting))))) ;; return line-no of posting
(defun ledger-do-reconcile ()
"get the uncleared transactions in the account and display them