Skip to content
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

Context at point doesn't handle negative commoditized amounts properly #211

Open
kevinjfoley opened this issue Nov 9, 2019 · 3 comments · May be fixed by #212
Open

Context at point doesn't handle negative commoditized amounts properly #211

kevinjfoley opened this issue Nov 9, 2019 · 3 comments · May be fixed by #212

Comments

@kevinjfoley
Copy link
Contributor

This seems to be because ledger-commoditized-amount-regexp doesn't properly handle negated amounts like -$100, so ledger-extract-context-info returns the account context with the separator and amount included in the account name.

For example calling ledger-context-at-point with point at | below:

2011/01/27 Book Store
    Expenses:Books                            $20.00
    Liabilities:MasterCard                   -$20.00|

returns:
(acct-transaction account ((indent " " 76) (status nil nil) (account "Liabilities:MasterCard -$20.00" 80)))

I believe I have a fix and will open a PR shortly.

@jabranham
Copy link
Collaborator

I'm surprised that -$20.00 works like that. I'd figure that ledger would interpret -$ as a commodity.

@kevinjfoley kevinjfoley linked a pull request Nov 11, 2019 that will close this issue
@kevinjfoley
Copy link
Contributor Author

Yeah I'm surprised as well, maybe it's best to just avoid using this notation since there's probably lots of features in ledger-mode where it isn't accounted for?

I only use it because that's how ledger-autosync formats transactions, maybe it would be better to add some support for $-100.00 formatting there (assuming it doesn't already have it, I couldn't find it when I looked)

@jwiegley
Copy link
Member

@jabranham - is somewhat special. "-$" is how you would specify such a commodity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants