Skip to content

Commit

Permalink
beancount-show supports interactive use
Browse files Browse the repository at this point in the history
  • Loading branch information
vkazanov committed Jun 4, 2024
1 parent 22c9280 commit 109e9ef
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions beancount.el
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,8 @@ With an argument move to the previous non cleared transaction."
"A list of the accounts available in this buffer.")
(make-variable-buffer-local 'beancount-accounts)

;; TODO: conditions here full test coverage. It seems that some of the
;; cases do not work.
(defun beancount-completion-at-point ()
"Return the completion data relevant for the text at point."
(save-excursion
Expand Down Expand Up @@ -1291,8 +1293,11 @@ beginning."
(beancount-goto-next-transaction))))

(defun beancount-show (target)
"Hide everything but transactions marked with a TARGET (a link or
a tag)."
"Only show transactions marked with a TARGET (a link or a tag)."
(interactive
(list (completing-read
"Filter by tag/link:"
(beancount-collect-unique beancount-tag-or-link-regexp 0))))
(beancount--hide-region (point-min) (point-max))
(beancount-foreach-transaction
(when (beancount--current-line-rematch-p (regexp-quote target))
Expand Down

0 comments on commit 109e9ef

Please sign in to comment.