summaryrefslogtreecommitdiff
path: root/lisp/ledger-fontify.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/ledger-fontify.el')
-rw-r--r--lisp/ledger-fontify.el20
1 files changed, 17 insertions, 3 deletions
diff --git a/lisp/ledger-fontify.el b/lisp/ledger-fontify.el
index 1023cd85..83c8753c 100644
--- a/lisp/ledger-fontify.el
+++ b/lisp/ledger-fontify.el
@@ -38,6 +38,7 @@
(defun ledger-fontify-whole-buffer ()
(interactive)
(save-excursion
+ (message "Ledger fontify whole buffer")
(goto-char (point-min))
(while (not (eobp))
(cond ((looking-at ledger-xact-start-regex)
@@ -53,13 +54,26 @@
(interactive)
(if (string= (format-mode-line 'mode-name) "Ledger")
(progn
- (add-hook 'post-command-hook 'ledger-fontify-buffer-part))))
+ (add-hook 'after-change-functions 'ledger-fontify-buffer-part)
+; (add-hook 'before-change-functions 'ledger-fontify-ensure-activation)
+ (message "ledger-fontify-activate called"))))
-(defun ledger-fontify-buffer-part ()
+(defun ledger-fontify-ensure-activation (beg end)
+ (if (string= (format-mode-line 'mode-name) "Ledger")
+ (add-hook 'after-change-functions 'ledger-fontify-buffer-part)))
+
+(defun ledger-fontify-buffer-part (beg end len)
(save-excursion
+ (message (concat "ledger-fontify-buffer-part: "
+ (int-to-string beg) " "
+ (int-to-string end) " "
+ (int-to-string len)
+ ))
+; (goto-char beg)
(backward-paragraph)
(forward-char)
- (cond ((looking-at ledger-xact-start-regex)
+ (cond ((or (looking-at ledger-xact-start-regex)
+ (looking-at ledger-posting-regex))
(ledger-fontify-xact-at (point)))
((looking-at ledger-directive-start-regex)
(ledger-fontify-directive-at (point))))))