From 4cb2779464073aa8f1ba9d25121e3496fa71168f Mon Sep 17 00:00:00 2001 From: Craig Earls Date: Sat, 23 Feb 2013 17:53:55 -0700 Subject: ledger-mode now automatically loads and parses the init file. Currently only pays attention to decimal-comma --- lisp/ldg-commodities.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lisp/ldg-commodities.el') diff --git a/lisp/ldg-commodities.el b/lisp/ldg-commodities.el index 14cc168f..7f15ab81 100644 --- a/lisp/ldg-commodities.el +++ b/lisp/ldg-commodities.el @@ -36,7 +36,6 @@ This only has effect interfacing to calc mode in edit amount" :type 'boolean :group 'ledger) - (defun ledger-split-commodity-string (str) "Split a commoditized amount into two parts" (let (val @@ -85,7 +84,7 @@ DIRECTION can be :to-user or :from-user. All math calculations are done with decimal-period, some users may prefer decimal-comma which must be translated both directions." (let ((val number-string)) - (if ledger-use-decimal-comma + (if (assoc "decimal-comma" ledger-environment-alist) (cond ((eq direction :from-user) ;; change string to decimal-period (while (string-match "," val) -- cgit v1.2.3 From 821847b0185f3d69bfbe3af3867556335111b9a2 Mon Sep 17 00:00:00 2001 From: Craig Earls Date: Tue, 26 Feb 2013 10:42:30 -0700 Subject: Ensure that commodities using decimal period, have comma separators removed for string-to-number. --- lisp/ldg-commodities.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lisp/ldg-commodities.el') diff --git a/lisp/ldg-commodities.el b/lisp/ldg-commodities.el index 7f15ab81..612350b3 100644 --- a/lisp/ldg-commodities.el +++ b/lisp/ldg-commodities.el @@ -94,7 +94,9 @@ which must be translated both directions." (while (string-match "\\." val) (setq val (replace-match "," nil nil val)))) ;; gets rid of periods (t - (error "ledger-commodity-string-number-decimalize: direction not properly specified %S" direction)))) + (error "ledger-commodity-string-number-decimalize: direction not properly specified %S" direction))) + (while (string-match "," val) + (setq val (replace-match "" nil nil val)))) val)) -- cgit v1.2.3