From 57e2ec55ebaf97a285d31391425db58a68a578fb Mon Sep 17 00:00:00 2001 From: Craig Earls Date: Mon, 8 Sep 2014 20:31:45 -0700 Subject: [PATCH] Seems to be working. I wasn't ensuring I caught all the xacts in a region specified by hit lock. Now I need to prune code --- lisp/ledger-fontify.el | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/lisp/ledger-fontify.el b/lisp/ledger-fontify.el index f282167e..7b9e121b 100644 --- a/lisp/ledger-fontify.el +++ b/lisp/ledger-fontify.el @@ -65,19 +65,17 @@ (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 ((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)))))) + (unless beg (setq beg (point-min))) + (unless end (setq end (point-max))) + (unless len (setq len (- end beg))) + (goto-char beg) + (while (< (point) end) + (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)))) + (ledger-xact-next-xact-or-directive)))) (defun ledger-fontify-xact-at (position) (interactive "d")