diff options
author | Craig Earls <enderw88@gmail.com> | 2013-02-27 10:07:59 -0700 |
---|---|---|
committer | Craig Earls <enderw88@gmail.com> | 2013-02-27 10:07:59 -0700 |
commit | 3db3d23765f9e48e52ce0c7f322f6031588d5d2f (patch) | |
tree | 891dada8833bda71452b0838da6c907f969fbc7d /lisp | |
parent | e5dd5344efca4851412eb21076b5715ffe99f212 (diff) | |
parent | 1e3c795935dc5c938b78fc367ee19e1a259b0fb3 (diff) | |
download | fork-ledger-3db3d23765f9e48e52ce0c7f322f6031588d5d2f.tar.gz fork-ledger-3db3d23765f9e48e52ce0c7f322f6031588d5d2f.tar.bz2 fork-ledger-3db3d23765f9e48e52ce0c7f322f6031588d5d2f.zip |
Merge branch 'next' into ledger-mode-documentation
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/ldg-commodities.el | 1 | ||||
-rw-r--r-- | lisp/ldg-regex.el | 2 | ||||
-rw-r--r-- | lisp/ldg-xact.el | 4 |
3 files changed, 5 insertions, 2 deletions
diff --git a/lisp/ldg-commodities.el b/lisp/ldg-commodities.el index 612350b3..6f835221 100644 --- a/lisp/ldg-commodities.el +++ b/lisp/ldg-commodities.el @@ -36,6 +36,7 @@ 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 diff --git a/lisp/ldg-regex.el b/lisp/ldg-regex.el index 680063f7..e81394ef 100644 --- a/lisp/ldg-regex.el +++ b/lisp/ldg-regex.el @@ -24,6 +24,8 @@ (eval-when-compile (require 'cl)) +(defvar ledger-date-regex "\\([0-9]+\\)[/-]\\([0-9]+\\)[/-]\\([0-9]+\\)") + (defmacro ledger-define-regexp (name regex docs &rest args) "Simplify the creation of a Ledger regex and helper functions." (let ((defs diff --git a/lisp/ldg-xact.el b/lisp/ldg-xact.el index f5a38ef6..8db50df2 100644 --- a/lisp/ldg-xact.el +++ b/lisp/ldg-xact.el @@ -106,7 +106,7 @@ within the transaction." (extents (ledger-find-xact-extents (point))) (transaction (buffer-substring (car extents) (cadr extents))) encoded-date) - (if (string-match "\\([0-9]+\\)/\\([0-9]+\\)/\\([0-9]+\\)" date) + (if (string-match ledger-date-regex date) (setq encoded-date (encode-time 0 0 0 (string-to-number (match-string 3 date)) (string-to-number (match-string 2 date)) @@ -114,7 +114,7 @@ within the transaction." (ledger-find-slot encoded-date) (insert transaction "\n") (backward-paragraph) - (re-search-forward "\\([0-9]+\\)/\\([0-9]+\\)/\\([0-9]+\\)") + (re-search-forward ledger-date-regex) (replace-match date) (re-search-forward "[1-9][0-9]+\.[0-9]+"))) |