summaryrefslogtreecommitdiff
path: root/lisp/ldg-commodities.el
diff options
context:
space:
mode:
authorCraig Earls <enderw88@gmail.com>2013-03-20 22:20:00 -0700
committerCraig Earls <enderw88@gmail.com>2013-03-20 22:20:00 -0700
commit045c4b19eb626b814a889ec8b5e2e66ecee39cc6 (patch)
tree347e0e90a5c5097a10fd33a22212ddd6abc5399e /lisp/ldg-commodities.el
parent7c6f9005922dc22b257b4acc9b6639f4c5589638 (diff)
downloadfork-ledger-045c4b19eb626b814a889ec8b5e2e66ecee39cc6.tar.gz
fork-ledger-045c4b19eb626b814a889ec8b5e2e66ecee39cc6.tar.bz2
fork-ledger-045c4b19eb626b814a889ec8b5e2e66ecee39cc6.zip
Added checking for thousands separators in commodity split.
Diffstat (limited to 'lisp/ldg-commodities.el')
-rw-r--r--lisp/ldg-commodities.el8
1 files changed, 5 insertions, 3 deletions
diff --git a/lisp/ldg-commodities.el b/lisp/ldg-commodities.el
index 9291136f..0ed52fc3 100644
--- a/lisp/ldg-commodities.el
+++ b/lisp/ldg-commodities.el
@@ -34,12 +34,14 @@
(defun ledger-split-commodity-string (str)
"Split a commoditized amount into two parts"
(if (> (length str) 0)
- (let (val
- comm)
+ (let (val comm number-regex)
(with-temp-buffer
(insert str)
(goto-char (point-min))
- (cond ((re-search-forward "-?[1-9][0-9]*[.,][0-9]*" nil t)
+ (if (assoc "decimal-comma" ledger-environment-alist)
+ (setq number-regex "-?[1-9][0-9.]*[,][0-9]*")
+ (setq number-regex "-?[1-9][0-9,]*[.][0-9]*"))
+ (cond ((re-search-forward number-regex nil t)
;; found a decimal number
(setq val
(string-to-number