[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 17:53:20 +0800 |
On Thu, Sep 23, 2021 at 5:40 PM Gregory Heytings <gregory@heytings.org> wrote:
>
>
> >
> > Imagine I've got the following in a text file opened under Emacs:
> >
> > some 34
> > word 30
> > another 38
> > thing 59
> > to 39
> > say 10
> > here 47
> >
> > and I want to turn into this, adding 1 to every number made of 2 digits:
> >
> > some 35
> > word 31
> > another 39
> > thing 60
> > to 40
> > say 11
> > here 48
> >
>
> This is a typical job for a macro. Move the cursor to the beginning of
> the first item of the list, then do:
>
> C-x (
> C-e
> M-b
> M-: (insert (format "%d" (1+ (number-at-point))))
> C-k
> C-a
> C-n
> C-x )
>
> Then type C-x e e e ...
Seems complicated :-)
HZ
- Re: Emacs: adding 1 to every number made of 2 digits inside a marked region., (continued)
- Re: Emacs: adding 1 to every number made of 2 digits inside a marked region., Hongyi Zhao, 2021/09/23
- Re: Emacs: adding 1 to every number made of 2 digits inside a marked region., Hongyi Zhao, 2021/09/23
- Re: Emacs: adding 1 to every number made of 2 digits inside a marked region., Gregory Heytings, 2021/09/23
- Re: Emacs: adding 1 to every number made of 2 digits inside a marked region., Hongyi Zhao, 2021/09/23
- Re: Emacs: adding 1 to every number made of 2 digits inside a marked region., Gregory Heytings, 2021/09/23
- Re: Emacs: adding 1 to every number made of 2 digits inside a marked region., Andreas Röhler, 2021/09/23
- Re: Emacs: adding 1 to every number made of 2 digits inside a marked region., Hongyi Zhao, 2021/09/23
- Re: Emacs: adding 1 to every number made of 2 digits inside a marked region., Andreas Röhler, 2021/09/23
- Re: Emacs: adding 1 to every number made of 2 digits inside a marked region., Hongyi Zhao, 2021/09/23
- Re: Emacs: adding 1 to every number made of 2 digits inside a marked region., Gregory Heytings, 2021/09/23
- Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.,
Hongyi Zhao <=
- Re: Emacs: adding 1 to every number made of 2 digits inside a marked region., Gregory Heytings, 2021/09/23
- RE: [External] : Re: Emacs: adding 1 to every number made of 2 digits inside a marked region., Drew Adams, 2021/09/23
- Re: [External] : Re: Emacs: adding 1 to every number made of 2 digits inside a marked region., Emanuel Berg, 2021/09/23
- RE: [External] : Re: Emacs: adding 1 to every number made of 2 digits inside a marked region., Drew Adams, 2021/09/23
- Re: [External] : Re: Emacs: adding 1 to every number made of 2 digits inside a marked region., Emanuel Berg, 2021/09/23
- RE: [External] : Re: Emacs: adding 1 to every number made of 2 digits inside a marked region., Drew Adams, 2021/09/23
- Re: [External] : Re: Emacs: adding 1 to every number made of 2 digits inside a marked region., Gregory Heytings, 2021/09/24
- Re: [External] : Re: Emacs: adding 1 to every number made of 2 digits inside a marked region., Emanuel Berg, 2021/09/24
- Re: Emacs: adding 1 to every number made of 2 digits inside a marked region., Andreas Röhler, 2021/09/23
- Re: Emacs: adding 1 to every number made of 2 digits inside a marked region., Michael Heerdegen, 2021/09/26