]> code.delx.au - gnu-emacs/commit
Rework xref-query-replace-in-results
authorDmitry Gutov <dgutov@yandex.ru>
Wed, 4 May 2016 23:52:34 +0000 (02:52 +0300)
committerDmitry Gutov <dgutov@yandex.ru>
Thu, 5 May 2016 00:26:04 +0000 (03:26 +0300)
commit922c7a3e48e649ad67bd12b1f83343b730dd1bc4
tree551beacca9963c49e4d3a8e14be27b80e4728b83
parent3fe351072841becbb1902c19f784890949f41c1d
Rework xref-query-replace-in-results

* lisp/progmodes/xref.el (xref-query-replace-in-results): Collect
all xrefs from the buffer first, then delegate most of the
processing to the value returned by xref--buf-pairs-iterator.
(xref--buf-pairs-iterator): New function.  Return an "iterator"
which partitions returned markers into buffers, and only processes
markers from one buffer at a time.  When an xref is out of date,
skip it with a message instead of signaling error (bug#23284).
(xref--outdated-p): Extract from xref--buf-pairs-iterator.  Trim
CR from both strings before comparing.
(xref--query-replace-1): Remove the variable current-buf, no need
to track it anymore.  Simplify the filter-predicate and search
functions accordingly.  Iterate over buffer-markers pairs returned
by the iterator, and call `perform-replace' for each of them.  Use
multi-query-replace-map (bug#23284).  Use `switch-to-buffer' every
time after the first, in order not to jump between windows.

* test/automated/xref-tests.el
(xref--buf-pairs-iterator-groups-markers-by-buffers-1)
(xref--buf-pairs-iterator-groups-markers-by-buffers-2)
(xref--buf-pairs-iterator-cleans-up-markers): New tests.
lisp/progmodes/xref.el
test/automated/xref-tests.el