From ad4eac43a99af8f6d88efefd8921fb71d7626de0 Mon Sep 17 00:00:00 2001 From: Christophe Rhodes Date: Wed, 23 Apr 2014 17:04:19 +0100 Subject: add "year" handling to ledger-iterate-regex --- lisp/ledger-regex.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lisp/ledger-regex.el') diff --git a/lisp/ledger-regex.el b/lisp/ledger-regex.el index 8d838892..3b43172d 100644 --- a/lisp/ledger-regex.el +++ b/lisp/ledger-regex.el @@ -325,7 +325,7 @@ (note end-note)) (defconst ledger-iterate-regex - (concat "\\(Y\\s-+\\([0-9]+\\)\\|" ;; Catches a Y directive + (concat "\\(\\(?:Y\\|year\\)\\s-+\\([0-9]+\\)\\|" ;; Catches a Y/year directive ledger-iso-date-regexp "\\([ *!]+\\)" ;; mark "\\((.*)\\)?" ;; code -- cgit v1.2.3 From e2d3e02b0d998a74b76f02f0f8e1fa3d5cd2df5e Mon Sep 17 00:00:00 2001 From: Christophe Rhodes Date: Wed, 23 Apr 2014 17:43:43 +0100 Subject: fix ledger-iso-date-regex, abusing its name slightly the year field in dates is sort-of optional, given "year" or "Y" directives. Make the date regex understand this. (This has been lightly tested with C-c C-a, but the rest of the uses of ledger-iso-date-regex have only been eyeballed, not properly audited or tested) --- lisp/ledger-regex.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lisp/ledger-regex.el') diff --git a/lisp/ledger-regex.el b/lisp/ledger-regex.el index 3b43172d..91344523 100644 --- a/lisp/ledger-regex.el +++ b/lisp/ledger-regex.el @@ -178,8 +178,8 @@ (ledger-define-regexp iso-date ( let ((sep '(or ?- ?/))) (rx (group - (and (group (? (= 4 num))) - (eval sep) + (and (? (and (group (= 4 num))) + (eval sep)) (group (and num (? num))) (eval sep) (group (and num (? num))))))) -- cgit v1.2.3