Skip to content

Commit

Permalink
beancount-foreach-transaction macro cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
vkazanov committed Jun 4, 2024
1 parent 94c16b7 commit 58df1e2
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions beancount.el
Original file line number Diff line number Diff line change
Expand Up @@ -1279,15 +1279,11 @@ Essentially a much simplified version of `next-line'."
Evaluate BODY for every transaction with point set to transaction
beginning."
(declare (indent 1))
(declare (indent 0) (debug t))
`(save-excursion
(goto-char (point-min))
;; maybe within a transaction already
(when (beancount-inside-transaction-p)
,@body)

;; all the other transactions
(beancount-goto-next-transaction)
(unless (beancount-inside-transaction-p)
(beancount-goto-next-transaction))
(while (beancount-inside-transaction-p)
,@body
(beancount-goto-next-transaction))))
Expand All @@ -1296,15 +1292,15 @@ beginning."
"Hide everything but transactions marked with a TAG."
(beancount--hide-region (point-min) (point-max))
(beancount-foreach-transaction
(when (beancount--current-line-rematch-p (regexp-quote tag))
(beancount--show-current-transaction))))
(when (beancount--current-line-rematch-p (regexp-quote tag))
(beancount--show-current-transaction))))

(defun beancount-link-show (link)
"Hide everything but transactions marked with a LINK."
(beancount--hide-region (point-min) (point-max))
(beancount-foreach-transaction
(when (beancount--current-line-rematch-p (regexp-quote link))
(beancount--show-current-transaction))))
(when (beancount--current-line-rematch-p (regexp-quote link))
(beancount--show-current-transaction))))

(defun beancount--tag-clicked (pos)
"Handle a tag click by only showing transactions with the link at
Expand Down

0 comments on commit 58df1e2

Please sign in to comment.