feat(beancount): add {next,previous}-transaction commands

This commit is contained in:
Henrik Lissner 2023-02-25 20:45:15 -05:00
parent 6471690782
commit 9d9b278914
No known key found for this signature in database
GPG key ID: B60957CA074D39A3
2 changed files with 16 additions and 0 deletions

View file

@ -164,3 +164,17 @@ Updates the date to today"
(delete-blank-lines)
(beancount-insert-date)
(insert transaction)))))
;;;###autoload
(defun +beancount/next-transaction (&optional count)
"Jump to the start of the next COUNT-th transaction."
(interactive "p")
(dotimes (_ (or count 1))
(beancount-goto-next-transaction)))
;;;###autoload
(defun +beancount/previous-transaction (&optional count)
"Jump to the start of current or previous COUNT-th transaction."
(interactive "p")
(re-search-backward
beancount-transaction-regexp nil t (or count 1)))

View file

@ -21,6 +21,8 @@
"TAB" (cmds! (and outline-minor-mode (outline-on-heading-p))
#'beancount-outline-cycle
#'indent-according-to-mode)
:m "[[" #'+beancount/previous-transaction
:m "]]" #'+beancount/next-transaction
:localleader
"b" #'+beancount/balance
"c" #'beancount-check