From 6fe913aa87ebb84dc39f6277aeeb6abf716c2985 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Sat, 22 Aug 2015 15:17:59 -0700 Subject: 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] --- lisp/ledger-xact.el | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lisp') 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." -- cgit v1.2.3