More regex finetuning in context
This commit is contained in:
parent
345f4a977e
commit
9b5289c3e9
1 changed files with 8 additions and 4 deletions
|
|
@ -32,11 +32,11 @@
|
||||||
;; form the regex and list of elements
|
;; form the regex and list of elements
|
||||||
(defconst indent-string "\\(^[ \t]+\\)")
|
(defconst indent-string "\\(^[ \t]+\\)")
|
||||||
(defconst status-string "\\([*! ]?\\)")
|
(defconst status-string "\\([*! ]?\\)")
|
||||||
(defconst account-string "[\\[(]?\\(.*?\\)[])]?")
|
(defconst account-string "[\\[(]?\\(.*?\\)[])]?[ \t]\\{2\\}")
|
||||||
(defconst amount-string "\\s-\\s-[ \t]+\\(-?[0-9]+\\.[0-9]*\\)")
|
(defconst amount-string "[ \t]?\\(-?[0-9]+\\.[0-9]*\\)")
|
||||||
(defconst comment-string "[ \t]*;[ \t]*\\(.*?\\)")
|
(defconst comment-string "[ \t]*;[ \t]*\\(.*?\\)")
|
||||||
(defconst nil-string "[ \t]+")
|
(defconst nil-string "[ \t]+")
|
||||||
(defconst commodity-string "\\(.*\\)")
|
(defconst commodity-string "\\(.+?\\)")
|
||||||
(defconst date-string "^\\(\\([0-9]\\{4\\}[/-]\\)?[01]?[0-9][/-][0123]?[0-9]\\)")
|
(defconst date-string "^\\(\\([0-9]\\{4\\}[/-]\\)?[01]?[0-9][/-][0123]?[0-9]\\)")
|
||||||
(defconst code-string "\\((\\(.*\\))\\)?")
|
(defconst code-string "\\((\\(.*\\))\\)?")
|
||||||
(defconst payee-string "\\(.*\\)")
|
(defconst payee-string "\\(.*\\)")
|
||||||
|
|
@ -50,7 +50,7 @@
|
||||||
(intern
|
(intern
|
||||||
(concat (symbol-name e) "-string")))))) "[ \t]*$")))
|
(concat (symbol-name e) "-string")))))) "[ \t]*$")))
|
||||||
|
|
||||||
(defmacro single-line-config (&rest elements)
|
(defmacro single-line-config2 (&rest elements)
|
||||||
"Take list of ELEMENTS and return regex and element list for use in context-at-point"
|
"Take list of ELEMENTS and return regex and element list for use in context-at-point"
|
||||||
(let (regex-string)
|
(let (regex-string)
|
||||||
`'(,(concat (dolist (e elements regex-string)
|
`'(,(concat (dolist (e elements regex-string)
|
||||||
|
|
@ -61,6 +61,10 @@
|
||||||
(concat (symbol-name e) "-string")))))) "[ \t]*$")
|
(concat (symbol-name e) "-string")))))) "[ \t]*$")
|
||||||
,elements)))
|
,elements)))
|
||||||
|
|
||||||
|
(defmacro single-line-config (&rest elements)
|
||||||
|
"Take list of ELEMENTS and return regex and element list for use in context-at-point"
|
||||||
|
`'(,(eval `(line-regex ,@elements))
|
||||||
|
,elements))
|
||||||
|
|
||||||
(defconst ledger-line-config
|
(defconst ledger-line-config
|
||||||
(list (list 'xact (list (single-line-config date nil status nil nil code payee comment)
|
(list (list 'xact (list (single-line-config date nil status nil nil code payee comment)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue