summaryrefslogtreecommitdiff
path: root/lisp/ldg-commodities.el
diff options
context:
space:
mode:
authorCraig Earls <enderw88@gmail.com>2013-04-02 23:13:23 -0700
committerCraig Earls <enderw88@gmail.com>2013-04-02 23:13:23 -0700
commit519e57ca1fac01ea057bea8263c6cb06a8ac4e7e (patch)
tree83529f38b2fb22b4ac5e29c3cc4c4c6047be5309 /lisp/ldg-commodities.el
parent86d0fd87c49e20b0f5262e7ae48234986584b750 (diff)
downloadfork-ledger-519e57ca1fac01ea057bea8263c6cb06a8ac4e7e.tar.gz
fork-ledger-519e57ca1fac01ea057bea8263c6cb06a8ac4e7e.tar.bz2
fork-ledger-519e57ca1fac01ea057bea8263c6cb06a8ac4e7e.zip
Consolidated all major regexes into ldg-regex. Only major exception are the regex in ledger context at point.
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 8755166d..031bddeb 100644
--- a/lisp/ldg-commodities.el
+++ b/lisp/ldg-commodities.el
@@ -26,6 +26,8 @@
;;; Code:
+(require 'ldg-regex)
+
(defcustom ledger-reconcile-default-commodity "$"
"The default commodity for use in target calculations in ledger reconcile."
:type 'string
@@ -36,13 +38,13 @@
Returns a list with (value commodity)."
(if (> (length str) 0)
(let ((number-regex (if (assoc "decimal-comma" ledger-environment-alist)
- "-?[1-9][0-9.]*[,]?[0-9]*"
- "-?[1-9][0-9,]*[.]?[0-9]*")))
+ ledger-amount-decimal-comma-regex
+ ledger-amount-decimal-period-regex)))
(with-temp-buffer
(insert str)
(goto-char (point-min))
(cond
- ((re-search-forward "\"\\(.*\\)\"" nil t)
+ ((re-search-forward "\"\\(.*\\)\"" nil t) ; look for quoted commodities
(let ((com (delete-and-extract-region
(match-beginning 1)
(match-end 1))))