summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorAndrew Schwartzmeyer <andrew@schwartzmeyer.com>2015-08-22 15:17:59 -0700
committerAndrew Schwartzmeyer <andrew@schwartzmeyer.com>2015-08-22 15:27:00 -0700
commit6fe913aa87ebb84dc39f6277aeeb6abf716c2985 (patch)
treef071d9b7fcc54a3a6f92be69b147f4a74e9e2663 /lisp
parent9627e2a97b56826e723eee0b8410a3e12bde4bb9 (diff)
downloadfork-ledger-6fe913aa87ebb84dc39f6277aeeb6abf716c2985.tar.gz
fork-ledger-6fe913aa87ebb84dc39f6277aeeb6abf716c2985.tar.bz2
fork-ledger-6fe913aa87ebb84dc39f6277aeeb6abf716c2985.zip
Fix xact-find-slot at end of buffer
Using `ledger-add-transaction` to add a transaction with a date that places it at the end of the buffer will "forget" to insert the newline between it and the previous transaction. This error occurs in `ledger-xact-find-slot` where the `(when (and (eobp) last-xact-start)` is entered, but subsequently the `(if (eobp))` is false because the point has been moved to the end of the prior exact, which is not the end of the buffer. The `if` expression is superfluous because the `when` expression has already been entered, and it is broken becase the point gets moved. Removing it fixes the behavior for transactions added at the end of the buffer, and does not break the behavior for transactions added elsewhere. This was observed with Emacs 24.5.50.1 and Ledger 3.1.0-20141005. [ci skip]
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ledger-xact.el5
1 files changed, 2 insertions, 3 deletions
diff --git a/lisp/ledger-xact.el b/lisp/ledger-xact.el
index 64f69cbe..513f8f26 100644
--- a/lisp/ledger-xact.el
+++ b/lisp/ledger-xact.el
@@ -89,9 +89,8 @@ MOMENT is an encoded date"
(when (and (eobp) last-xact-start)
(let ((end (cadr (ledger-navigate-find-xact-extents last-xact-start))))
(goto-char end)
- (if (eobp)
- (insert "\n")
- (forward-line))))))
+ (insert "\n")
+ (forward-line)))))
(defun ledger-xact-iterate-transactions (callback)
"Iterate through each transaction call CALLBACK for each."