I'm writing a loop to perform some interactive replacements on matched strings:
(while (search-forward-regexp "REGEXP" nil t)
(read-char "Options:...")
; Replacements...
)
and I need the matched string to be "temporarily" highlighted until the replacement has done (or skipped).
What is the best way to get this behaviour?
(I figure out something like this:
(while (search-forward-regexp "REGEXP" nil t)
(push-mark (match-beginning 0))
(let ((x (make-overlay (mark) (point))))
(overlay-put x 'face '(:background "grey20")))
(read-char "Options:... ")
(remove-overlays (mark) (point))
)
but I'm pretty sure it is not the best choice)