-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Xref backend for beancount-mode #50
Conversation
Thanks @vkazanov, this is exactly the kind of addition to beancount-mode that I would like to have! |
@dnicolodi, BTW, I have this other idea I want to experiment with: specialize outline-minor-mode's approach a bit to beancount-mode's needs. The plan:
Given how large the files tend to become this should help quite a bit Would you be open to such an improvement? Obviously, I'd finish the xref backend first. |
@dnicolodi sorry for nudging (gently). Any updates necessary? Thank you |
c2acc6e
to
7c930fa
Compare
This will allow to use the same code for the xref backend.
beancount.el
Outdated
(defconst beancount-open-directive-regexp | ||
(concat "^\\(" beancount-date-regexp "\\) +" | ||
"\\(open\\) +" | ||
"\\(" beancount-account-regexp "\\) +")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is problematic as it requires the open
directive to have a space after the account name, but one is not required:
2024-06-03 open Assets:Foo
is a valid open directive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooops. Should be good now.
Hello again,
I've added another quality-of-life improvement I felt was both useful and easy enough to implement: an Xref backend. This adds support for:
While it is not hard to use basic tools such as grep with Beancount files, I felt that working from standard tooling aligns well with other modes supporting Xref and would be helpful to people used to default keybindings.
I checked it in Emacs 26, 27, 28, 29. It was not without some complications (a backported function) but should work everywhere out of the box.
Let me know if something needs tweaking.
Thanks!