diff options
author | Craig Earls <enderw88@gmail.com> | 2014-09-17 21:43:14 -0700 |
---|---|---|
committer | Craig Earls <enderw88@gmail.com> | 2014-09-17 21:43:14 -0700 |
commit | 2cb5c0903332b021bf4980ef9a54f024165ca2d8 (patch) | |
tree | 2ced150de757bea5933edeec441853a0ca495a09 /lisp | |
parent | c7cd14500e4ed9f0ccc2e57f7dcd1b27f1217946 (diff) | |
download | fork-ledger-2cb5c0903332b021bf4980ef9a54f024165ca2d8.tar.gz fork-ledger-2cb5c0903332b021bf4980ef9a54f024165ca2d8.tar.bz2 fork-ledger-2cb5c0903332b021bf4980ef9a54f024165ca2d8.zip |
Improve ledger occur region search
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/ledger-occur.el | 19 |
1 files changed, 6 insertions, 13 deletions
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" |