(query-replace "foo" "bar") shows you all occurrences of
foo and offers to replace them by
I would love to have a version of
query-replace that only picks the occurrences of
foo that are "in some context" (to be defined). At the moment, I'm thinking of LaTeX files with the context being "any part that is in math style". Or any part not in math style. These parts are already highlighted by Emacs'
latex-mode so it can recognize them.
query-replace can already perform a bit of context checking since its
DELIMITED argument allows restricting to occurrences surrounded by word boundaries, but this is a simple special case that can be implemented with regular expressions, e.g., looking for
My question: do you know of an extension of
query-replace in some package somewhere that can do the replace-only-in-math-style trick I need? Or of something similar enough that would be a good start for tweaking and hacking around?