elisp , .
( , , .)
, , 23 , , :
C-2 C-3 F3
C-SPC ;; set-mark-command
C-e ;; move-end-of-line
<<replace-regexp>> ;; replace-regexp
<f3> ;; kmacro-start-macro-or-insert-counter
C
M-@ ;; mark-word
M-w ;; kill-ring-save
RET ;; indent-new-comment-line
\ ;; self-insert-command
,(1+ ;; self-insert-command * 4
SPC ;; self-insert-command
C-y ;; yank
) ;; self-insert-command
RET ;; indent-new-comment-line
F4, .
(n.b. , .)
C-x C-k r .
You can re-set the macro counter to any desired value with C-x C-k C-cto re-play the macro in another region.
And depending on how your data really looks, you could probably greatly simplify this by completely eliminating replace-regexp, and instead just moving to where you know the number, deleting the existing number and inserting the counter value in its place .
phils source
share