From 2cb5c0903332b021bf4980ef9a54f024165ca2d8 Mon Sep 17 00:00:00 2001 From: Craig Earls Date: Wed, 17 Sep 2014 21:43:14 -0700 Subject: Improve ledger occur region search --- lisp/ledger-occur.el | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'lisp') diff --git a/lisp/ledger-occur.el b/lisp/ledger-occur.el index 0851307e..cd7a2674 100644 --- a/lisp/ledger-occur.el +++ b/lisp/ledger-occur.el @@ -155,23 +155,16 @@ Used for coordinating `ledger-occur' with other buffers, like reconcile." (save-excursion (goto-char (point-min)) ;; Set initial values for variables - (let (curpoint - endpoint - (lines (list))) + (let (endpoint lines bounds) ;; Search loop (while (not (eobp)) - (setq curpoint (point)) ;; if something found (when (setq endpoint (re-search-forward regex nil 'end)) - (save-excursion - (let ((bounds (ledger-navigate-find-xact-extents (match-beginning 0)))) - (push bounds lines) - (setq curpoint (cadr bounds)))) ;; move to the end of - ;; the xact, no need to - ;; search inside it more - (goto-char curpoint)) - (forward-line 1)) - (setq lines (nreverse lines))))) + (setq bounds (ledger-navigate-find-xact-extents endpoint)) + (push bounds lines) + ;; move to the end of the xact, no need to search inside it more + (goto-char (cadr bounds)))) + (nreverse lines)))) (defun ledger-occur-compress-matches (buffer-matches) "identify sequential xacts to reduce number of overlays required" -- cgit v1.2.3