help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs: adding 1 to every number made of 2 digits inside a marked reg


From: Hongyi Zhao
Subject: Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
Date: Thu, 23 Sep 2021 18:17:57 +0800

On Thu, Sep 23, 2021 at 6:11 PM Gregory Heytings <gregory@heytings.org> wrote:
>
>
> >
> > 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.

I'm not familiar with this usage, could you please give a concise
example based on the question discussed here?

HZ



reply via email to

[Prev in Thread] Current Thread [Next in Thread]