branch: elpa/beancount commit bde2d6c499ce630e4cc4beb79c0dffef2217e7b8 Author: Debanjum Singh Solanky <deban...@gmail.com> Commit: Daniele Nicolodi <dani...@grinta.net>
Add function to jump to previous transaction This function mirrors the existing `beancount-goto-next-transaction' --- beancount.el | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/beancount.el b/beancount.el index c3f5614ec4..810dbc8f49 100644 --- a/beancount.el +++ b/beancount.el @@ -425,6 +425,20 @@ With an argument move to the next non cleared transaction." (setq done t))) (if (not done) (goto-char (point-max))))) +(defun beancount-goto-previous-transaction (&optional arg) + "Move to the previous transaction. +With an argument move to the previous non cleared transaction." + (interactive "P") + (beancount-goto-transaction-begin) + (let ((done nil)) + (while (and (not done) + (re-search-backward beancount-transaction-regexp nil t)) + (if (and arg (string-equal (match-string 2) "*")) + (goto-char (match-beginning 0)) + (goto-char (match-beginning 0)) + (setq done t))) + (if (not done) (goto-char (point-min))))) + (defun beancount-find-transaction-extents (p) (save-excursion (goto-char p)