From 90d275098899c30b14a812452bbf068cadd1d4ad Mon Sep 17 00:00:00 2001 From: George Kettleborough Date: Thu, 11 Apr 2013 10:50:18 +0100 Subject: Stop account regexes matching comments --- lisp/ldg-regex.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lisp/ldg-regex.el') diff --git a/lisp/ldg-regex.el b/lisp/ldg-regex.el index 226475df..c17582eb 100644 --- a/lisp/ldg-regex.el +++ b/lisp/ldg-regex.el @@ -61,13 +61,13 @@ "^--.+?\\($\\|[ ]\\)") (defconst ledger-account-any-status-regex - "^[ \t]+\\([*!]\\s-+\\)?\\([[(]?.+?\\)\\(\t\\|\n\\| [ \t]\\)") + "^[ \t]+\\([*!]\\s-*\\)?\\([^ ;].*?\\)\\( \\|$\\)") (defconst ledger-account-pending-regex - "\\(^[ \t]+\\)\\(!.+?\\)\\( \\|$\\)") + "\\(^[ \t]+\\)\\(!\\s-*.*?\\)\\( \\|$\\)") (defconst ledger-account-cleared-regex - "\\(^[ \t]+\\)\\(\\*.+?\\)\\( \\|$\\)") + "\\(^[ \t]+\\)\\(*\\s-*.*?\\)\\( \\|$\\)") -- cgit v1.2.3 From 6396fe2bd78d63cee3caaeb45fdd4daddb68d88f Mon Sep 17 00:00:00 2001 From: George Kettleborough Date: Thu, 11 Apr 2013 10:50:38 +0100 Subject: Fix comment regex to include all line comment types --- lisp/ldg-fonts.el | 2 +- lisp/ldg-regex.el | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'lisp/ldg-regex.el') diff --git a/lisp/ldg-fonts.el b/lisp/ldg-fonts.el index cb7a81c0..8ba84c84 100644 --- a/lisp/ldg-fonts.el +++ b/lisp/ldg-fonts.el @@ -113,7 +113,7 @@ (defvar ledger-font-lock-keywords `( ;; (,ledger-other-entries-regex 1 ;; ledger-font-other-face) - (,ledger-comment-regex 2 + (,ledger-comment-regex 0 'ledger-font-comment-face) (,ledger-payee-pending-regex 2 'ledger-font-payee-pending-face) ; Works diff --git a/lisp/ldg-regex.el b/lisp/ldg-regex.el index c17582eb..8e843ae5 100644 --- a/lisp/ldg-regex.el +++ b/lisp/ldg-regex.el @@ -43,7 +43,7 @@ "\\(^[~=A-Za-z].+\\)+") (defconst ledger-comment-regex - "\\( \\| \\|^\\)\\(;.*\\)") + "^[;#|\\*%].*\\|[ \t]+;.*") (defconst ledger-payee-any-status-regex "^[0-9/.=-]+\\(\\s-+\\*\\)?\\(\\s-+(.*?)\\)?\\s-+\\(.+?\\)\\(\t\\|\n\\| [ \t]\\)") -- cgit v1.2.3 From 902d0f41ef610ab54786db7c859dbc86c4f6e1db Mon Sep 17 00:00:00 2001 From: George Kettleborough Date: Sat, 13 Apr 2013 21:56:17 +0100 Subject: Add regex for metadata --- lisp/ldg-regex.el | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'lisp/ldg-regex.el') diff --git a/lisp/ldg-regex.el b/lisp/ldg-regex.el index 8e843ae5..83bc2197 100644 --- a/lisp/ldg-regex.el +++ b/lisp/ldg-regex.el @@ -61,13 +61,22 @@ "^--.+?\\($\\|[ ]\\)") (defconst ledger-account-any-status-regex - "^[ \t]+\\([*!]\\s-*\\)?\\([^ ;].*?\\)\\( \\|$\\)") + "^[ \t]+\\(?1:[*!]\\s-*\\)?\\(?2:[^ ;].*?\\)\\( \\|\t\\|$\\)") (defconst ledger-account-pending-regex - "\\(^[ \t]+\\)\\(!\\s-*.*?\\)\\( \\|$\\)") + "\\(^[ \t]+\\)\\(!\\s-*.*?\\)\\( \\|\t\\|$\\)") (defconst ledger-account-cleared-regex - "\\(^[ \t]+\\)\\(*\\s-*.*?\\)\\( \\|$\\)") + "\\(^[ \t]+\\)\\(*\\s-*.*?\\)\\( \\|\t\\|$\\)") + +(defconst ledger-metadata-regex + "[ \t]+\\(?2:;[ \t]+.+\\)$") + +(defconst ledger-account-or-metadata-regex + (concat + ledger-account-any-status-regex + "\\|" + ledger-metadata-regex)) -- cgit v1.2.3