tweak(beancount): include directives for next/prev transaction
+beancount/next-transaction and +beancount/previous-transaction would formerly skip timestampped directives, e.g. 2016-09-15 * "Foo" "" Expenses:Y 779.00 DKK Assets:X:Checkings 2016-11-16 balance Assets:X:Checkings 8,417.58 DKK 2016-12-13 * "Bar" "" Assets:X:Checkings 2,100.00 DKK Income:Z The `balance` directive would be skipped over. This commit changes that to include them. Perhaps the commands should be renamed to +beancount/{next,previous}-entry to better reflect my intended purpose for them?
This commit is contained in:
parent
96e6b72be6
commit
36651d6e66
1 changed files with 10 additions and 3 deletions
|
@ -172,12 +172,19 @@ Updates the date to today."
|
|||
(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)))
|
||||
(let ((beancount-transaction-regexp
|
||||
;; Don't skip over timestamped directives (like balance or event
|
||||
;; declarations).
|
||||
(concat beancount-timestamped-directive-regexp
|
||||
"\\|" beancount-transaction-regexp)))
|
||||
(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)))
|
||||
(concat beancount-timestamped-directive-regexp
|
||||
"\\|" beancount-transaction-regexp)
|
||||
nil t))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue