ledger-mode
ledger-mode copied to clipboard
Context at point doesn't handle negative commoditized amounts properly
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.
I'm surprised that -$20.00
works like that. I'd figure that ledger would interpret -$
as a commodity.
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)
@jabranham -
is somewhat special. "-$"
is how you would specify such a commodity.