Let me define a keyboard-macro: I enter C-x (, then go to beginning with M-<, then type M-% to query-replace some occurrences of foo by bar. Out of 3 occurrences found, I replace only the last 2, then save with C-x C-s and finish the kbd-macro with C-x ). Well done!!
If I now run the kbd-macro on another buffer, it will not ask me whether I want to replace foo by bar, it will reproduce exactly my previous no-yes-yes answers and replace the 2nd and 3rd occurrences! It will not ask for the 4th or 5th occurrences (this 2nd buffer contains more foos)!! This is not what I expected when I defined the macro. I wanted it to call query-replace
and let me answer its queries...
Aside question: Don't you find this wrong? [I can M-x edit-last-kbd-macro
and see what is recorded and understand the logic of it all but I still find this wrong.]
Real question: What could I have used instead of query-replace
to make my kbd-macro work as expected?