Improve ledger occur region search
This commit is contained in:
parent
c7cd14500e
commit
2cb5c09033
1 changed files with 6 additions and 13 deletions
|
|
@ -155,23 +155,16 @@ Used for coordinating `ledger-occur' with other buffers, like reconcile."
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
;; Set initial values for variables
|
;; Set initial values for variables
|
||||||
(let (curpoint
|
(let (endpoint lines bounds)
|
||||||
endpoint
|
|
||||||
(lines (list)))
|
|
||||||
;; Search loop
|
;; Search loop
|
||||||
(while (not (eobp))
|
(while (not (eobp))
|
||||||
(setq curpoint (point))
|
|
||||||
;; if something found
|
;; if something found
|
||||||
(when (setq endpoint (re-search-forward regex nil 'end))
|
(when (setq endpoint (re-search-forward regex nil 'end))
|
||||||
(save-excursion
|
(setq bounds (ledger-navigate-find-xact-extents endpoint))
|
||||||
(let ((bounds (ledger-navigate-find-xact-extents (match-beginning 0))))
|
(push bounds lines)
|
||||||
(push bounds lines)
|
;; move to the end of the xact, no need to search inside it more
|
||||||
(setq curpoint (cadr bounds)))) ;; move to the end of
|
(goto-char (cadr bounds))))
|
||||||
;; the xact, no need to
|
(nreverse lines))))
|
||||||
;; search inside it more
|
|
||||||
(goto-char curpoint))
|
|
||||||
(forward-line 1))
|
|
||||||
(setq lines (nreverse lines)))))
|
|
||||||
|
|
||||||
(defun ledger-occur-compress-matches (buffer-matches)
|
(defun ledger-occur-compress-matches (buffer-matches)
|
||||||
"identify sequential xacts to reduce number of overlays required"
|
"identify sequential xacts to reduce number of overlays required"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue