]> git.eshelyaron.com Git - emacs.git/commit
Keep track of match extents in occur-mode (bug#39121)
authorMattias Engdegård <mattiase@acm.org>
Sat, 24 Jul 2021 14:32:11 +0000 (16:32 +0200)
committerMattias Engdegård <mattiase@acm.org>
Sun, 25 Jul 2021 08:29:09 +0000 (10:29 +0200)
commitc52e26df30d5679dc2b9b34853a3c2db062524ac
tree1609b2b6b34afb5228fe2ddbe65c99f165b6af14
parentd3415724a686107236f78d745700221a397ffb4f
Keep track of match extents in occur-mode (bug#39121)

Use the `occur-target` text property to keep track of the extents of
all matches on each line instead of just the start of the first match.
Doing so allows us to highlight all matches when jumping to a matching
line instead of just the first one, and it works in a more principled
way.  It also removes compatibility problems that were introduced with
occur-highlight-regexp.

For compatibility with code that populate their own occur-mode
buffers, we still accept `occur-target` properties with a single
marker as value.

* lisp/replace.el (occur-highlight-regexp, occur-highlight-overlay):
Remove.
(occur-highlight-overlays): New.
(occur--targets-start): New.
* lisp/replace.el (occur-after-change-function):
(occur-mode-find-occurrence): Replace with...
(occur-mode--find-occurrences): ...this function that returns the
whole `occur-target` property value.
(occur-mode-goto-occurrence, occur-mode-goto-occurrence-other-window)
(occur-goto-locus-delete-o, occur-mode-display-occurrence)
(occur-engine): Adjust to new property format.
(occur--highlight-occurrence): Replace with...
(occur--highlight-occurrences): ...this function that takes
the `occur-target` property value as argument.
(occur-1): Don't use `occur-highlight-regexp`.
* test/lisp/replace-tests.el (occur-highlight-occurrence):
Adapt to new property format.
lisp/replace.el
test/lisp/replace-tests.el