Lets suppose I would like to edit my text and to add comments to the column in the text. This is my text:
something-text1 foobar1 something-text1
something-text2 foobar2 something-text2
---
something-textn foobarn something-textn
I want to add comments just after the words foobar
. I do the following: (||
is cursor):
||foobar1
M-x kmacro-start-macro-or-insert-counter
M-x forward-word
;; comment
M-x backward-word
M-x next-line
M-x kmacro-end-or-call-macro
Now I can repeat this keyboard macro on every line with the word foobar
with
M-x kmacro-start-macro-or-insert-counter
or
C-u kmacro-start-macro-or-insert-counter
and apply the command times.
I would like to do the same with rectangle-mark
. I would like to make
region with C-x SPC C-u ะก-n:
something-text1 ||foobar1 something-text1
something-text2 ||foobar2 something-text2
---
something-textn ||foobarn something-textn
Then I eval M-x kmacro-end-or-call-macro
, but it doesn't work in the way it works with help of above-mentioned command.
How can I apply a keyboard macro to every line that starts with rectangle mark region?