summaryrefslogtreecommitdiff
path: root/ledger-fontify.el
diff options
context:
space:
mode:
authorYuri Khan <yurivkhan@gmail.com>2017-07-05 14:45:00 +0700
committerYuri Khan <yurivkhan@gmail.com>2018-07-28 16:20:40 +0700
commit3492d60831647cd4f3e374a04a231ae1ca2bb1fd (patch)
tree840e3df64fc0b12389beecb5d3d3c965c2b2db4f /ledger-fontify.el
parent0f60ecb1ff5f4d613dafe763d197d5636d502110 (diff)
Fontify cleared and pending transactions using font-lock-keywords
* ledger-fontify-xact-at: Move logic… * ledger-font-lock-keywords: …here.
Diffstat (limited to 'ledger-fontify.el')
-rw-r--r--ledger-fontify.el24
1 files changed, 2 insertions, 22 deletions
diff --git a/ledger-fontify.el b/ledger-fontify.el
index 02744f5..0c32f67 100644
--- a/ledger-fontify.el
+++ b/ledger-fontify.el
@@ -49,33 +49,13 @@ This is for use as a `font-lock-fontify-region-function'."
(cond ((or (looking-at ledger-xact-start-regex)
(looking-at "^[=~][[:blank:]]")
(looking-at ledger-posting-regex)
- (looking-at ledger-recurring-line-regexp))
- (ledger-fontify-xact-at (point)))
- ((looking-at ledger-directive-start-regex)
+ (looking-at ledger-recurring-line-regexp)
+ (looking-at ledger-directive-start-regex))
(let ((extents (ledger-navigate-find-element-extents (point))))
(save-excursion
(font-lock-fontify-keywords-region (car extents) (cadr extents))))))
(ledger-navigate-next-xact-or-directive))))
-(defun ledger-fontify-xact-at (position)
- "Fontify the xact at POSITION."
- (interactive "d")
- (save-excursion
- (goto-char position)
- (let ((extents (ledger-navigate-find-element-extents position))
- (state (ledger-transaction-state)))
- (cond
- ((and ledger-fontify-xact-state-overrides state)
- (cond ((eq state 'cleared)
- (ledger-fontify-set-face extents 'ledger-font-xact-cleared-face))
- ((eq state 'pending)
- (ledger-fontify-set-face extents 'ledger-font-xact-pending-face)))))
- (font-lock-fontify-keywords-region (car extents) (cadr extents)))))
-
-(defun ledger-fontify-set-face (extents face)
- "Set the text in EXTENTS to FACE."
- (put-text-property (car extents) (cadr extents) 'face face))
-
(provide 'ledger-fontify)