Improve ledger-split-commodities to handle multi character commodities.
This commit is contained in:
parent
9079ae8a69
commit
0d0e996e07
1 changed files with 8 additions and 10 deletions
|
|
@ -48,18 +48,16 @@
|
||||||
(ledger-commodity-string-number-decimalize
|
(ledger-commodity-string-number-decimalize
|
||||||
(delete-and-extract-region (match-beginning 0) (match-end 0)) :from-user)))
|
(delete-and-extract-region (match-beginning 0) (match-end 0)) :from-user)))
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(re-search-forward "[^[:space:]]" nil t)
|
(setq comm (nth 0 (split-string (buffer-substring (point-min) (point-max)))))
|
||||||
(setq comm
|
|
||||||
(delete-and-extract-region (match-beginning 0) (match-end 0)))
|
|
||||||
(list val comm))
|
(list val comm))
|
||||||
((re-search-forward "0" nil t)
|
((re-search-forward "0" nil t)
|
||||||
;; couldn't find a decimal number, look for a single 0,
|
;; couldn't find a decimal number, look for a single 0,
|
||||||
;; indicating account with zero balance
|
;; indicating account with zero balance
|
||||||
(list 0 ledger-reconcile-default-commodity))
|
(list 0 ledger-reconcile-default-commodity))
|
||||||
(t
|
)))
|
||||||
(error "split-commodity-string: cannot parse commodity string: %S" str)))))
|
|
||||||
(list 0 ledger-reconcile-default-commodity)))
|
|
||||||
|
|
||||||
|
;; nothing found, return 0
|
||||||
|
(list 0 ledger-reconcile-default-commodity)))
|
||||||
|
|
||||||
(defun ledger-string-balance-to-commoditized-amount (str)
|
(defun ledger-string-balance-to-commoditized-amount (str)
|
||||||
"Return a commoditized amount (val, 'comm') from STR."
|
"Return a commoditized amount (val, 'comm') from STR."
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue