summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Earls <enderw88@gmail.com>2014-09-08 20:31:45 -0700
committerCraig Earls <enderw88@gmail.com>2014-09-08 20:31:45 -0700
commit57e2ec55ebaf97a285d31391425db58a68a578fb (patch)
tree7484942bea782b6d64309023d3e31bf43b572912
parent77e77f39dcb99df410e969f7bd6c574e4d05dbe8 (diff)
downloadfork-ledger-57e2ec55ebaf97a285d31391425db58a68a578fb.tar.gz
fork-ledger-57e2ec55ebaf97a285d31391425db58a68a578fb.tar.bz2
fork-ledger-57e2ec55ebaf97a285d31391425db58a68a578fb.zip
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
-rw-r--r--lisp/ledger-fontify.el24
1 files 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")