|
From: | Gregory Heytings |
Subject: | Re: Emacs: adding 1 to every number made of 2 digits inside a marked region. |
Date: | Thu, 23 Sep 2021 10:10:51 +0000 |
But how to increase/decrease in steps that are not equal to 1?
And this is exactly the point of macros: you can easily define another macro with the parameters you now need. E.g. if you want to multiply the numbers by 2 you just have to change
(insert (format "%d" (1+ (number-at-point)))) into (insert (format "%d" (* 2 (number-at-point))))Of course, if this is something you regularly need, it's better to use a defun, or to record the macro in your init file by copy-pasting the result of M-x insert-kbd-macro.
[Prev in Thread] | Current Thread | [Next in Thread] |