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]
This commit is contained in:
Andrew Schwartzmeyer 2015-08-22 15:17:59 -07:00
parent 9627e2a97b
commit 6fe913aa87
No known key found for this signature in database
GPG key ID: D50036A9A84A216F

View file

@ -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."