all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Emacs: adding 1 to every number made of 2 digits inside a marked region.
@ 2021-09-22 14:28 Hongyi Zhao
  2021-09-22 19:50 ` Stephen Berman
                   ` (5 more replies)
  0 siblings, 6 replies; 54+ messages in thread
From: Hongyi Zhao @ 2021-09-22 14:28 UTC (permalink / raw)
  To: help-gnu-emacs

Today, I stumbled on this interesting discussion here [1]:

--------------------
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
--------------------

I tried all the ELISP codes suggested there, and only found that the
following one is valid:

C-M-% \b[0-9][0-9]\b return \,(1+ \#&)

The other two can't do the trick:

First one:

(defun add-1-to-2-digits (b e)
  "add 1 to every 2 digit number in the region"
  (interactive "r")
  (goto-char b)
  (while (re-search-forward "\\b[0-9][0-9]\\b" e t)
    (replace-match (number-to-string (+ 1 (string-to-int (match-string 0)))))))

Validating method:

`M-:' input-the-above-code-here, RET, `M-x add-1-to-2-digits'.

And the second:

(while (re-search-forward "\\<[0-9][0-9]\\>" nil t) (let ((x
(match-string 0))) (delete-backward-char 2) (insert (format "%d" (1+
(string-to-int x))))))

Validating method:

`M-:' input-the-above-code-here, RET

[1] https://stackoverflow.com/questions/2686593/emacs-adding-1-to-every-number-made-of-2-digits-inside-a-marked-region

Any hints/comments/enhancements for these methods will be greatly appreciated?

Regards
-- 
Assoc. Prof. Hongyi Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Vocational University of Technology and Engineering
No. 473, Quannan West Street, Xindu District, Xingtai, Hebei province



^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-22 14:28 Emacs: adding 1 to every number made of 2 digits inside a marked region Hongyi Zhao
@ 2021-09-22 19:50 ` Stephen Berman
  2021-09-22 21:04   ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-09-23  0:23   ` Hongyi Zhao
  2021-09-22 20:38 ` Emanuel Berg via Users list for the GNU Emacs text editor
                   ` (4 subsequent siblings)
  5 siblings, 2 replies; 54+ messages in thread
From: Stephen Berman @ 2021-09-22 19:50 UTC (permalink / raw)
  To: Hongyi Zhao; +Cc: help-gnu-emacs

On Wed, 22 Sep 2021 22:28:28 +0800 Hongyi Zhao <hongyi.zhao@gmail.com> wrote:

> Today, I stumbled on this interesting discussion here [1]:
>
> --------------------
> 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
> --------------------
>
> I tried all the ELISP codes suggested there, and only found that the
> following one is valid:
>
> C-M-% \b[0-9][0-9]\b return \,(1+ \#&)
>
> The other two can't do the trick:
>
> First one:
>
> (defun add-1-to-2-digits (b e)
>   "add 1 to every 2 digit number in the region"
>   (interactive "r")
>   (goto-char b)
>   (while (re-search-forward "\\b[0-9][0-9]\\b" e t)
>     (replace-match (number-to-string (+ 1 (string-to-int (match-string 0)))))))
>
> Validating method:
>
> `M-:' input-the-above-code-here, RET, `M-x add-1-to-2-digits'.
>
> And the second:
>
> (while (re-search-forward "\\<[0-9][0-9]\\>" nil t) (let ((x
> (match-string 0))) (delete-backward-char 2) (insert (format "%d" (1+
> (string-to-int x))))))
>
> Validating method:
>
> `M-:' input-the-above-code-here, RET
>
> [1] https://stackoverflow.com/questions/2686593/emacs-adding-1-to-every-number-made-of-2-digits-inside-a-marked-region
>
> Any hints/comments/enhancements for these methods will be greatly appreciated?

`string-to-int' was made obsolete long ago and removed in Emacs 26 (see
NEWS.26); replace it with `string-to-number' in those code snippets and
they'll work.

Steve Berman



^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-22 14:28 Emacs: adding 1 to every number made of 2 digits inside a marked region Hongyi Zhao
  2021-09-22 19:50 ` Stephen Berman
@ 2021-09-22 20:38 ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-09-23  0:42   ` Hongyi Zhao
  2021-09-23  8:02   ` Hongyi Zhao
  2021-09-23  8:37 ` Andreas Röhler
                   ` (3 subsequent siblings)
  5 siblings, 2 replies; 54+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-09-22 20:38 UTC (permalink / raw)
  To: help-gnu-emacs

Hongyi Zhao wrote:

> Today, I stumbled on this interesting discussion [...]
>
> 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 [...]

When I was still classified as a human being I did something
similar and thanks to Emacs and that professional approach to
preparation that mini-expedition was concluded in
a semi-successful state since there were several survivors.

Here is the URL to the file but I also yank it last:

  https://dataswamp.org/~incal/TENT

tent                      2515
sleeping bag              1215
sleeping pad               880
Trangia                    619
comic book                 580
pillow                     450
science book               411
drybag                     305
thermos                    270
powerbank 8000mAh          245
water bottle               115
toothpaste                 110
piece of cloth (big)       100
knife                       90
sticky tape                 90
deodorant                   75
flashlight (3AAA)           73
piece of cloth (small)      60
flashlight (USB)            55
vaseline                    50
toothbrush                  15
skin lotion                 13
comb                        11
spoon/fork                   9
pill case                    9
------------------------------
                          8365g

(defun digits-sum ()
  (interactive)
  (save-excursion
    (goto-char (point-min))
    (let ((sum 0))
      (while (forward-word)
        (let ((number (number-at-point)))
          (when number
            (cl-incf sum number) )))
      (message "%s" sum) )))
(defalias 'di #'digits-sum)

-------------------------------------------------------------------------------

                  https://dataswamp.org/~incal/TENT

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-22 19:50 ` Stephen Berman
@ 2021-09-22 21:04   ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-09-23  0:23   ` Hongyi Zhao
  1 sibling, 0 replies; 54+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-09-22 21:04 UTC (permalink / raw)
  To: help-gnu-emacs

Stephen Berman wrote:

> `string-to-int' was made obsolete long ago and removed in
> Emacs 26 (see NEWS.26); replace it with `string-to-number'
> in those code snippets and they'll work.

That so, I have used the vocabulary/phrasing in my code, like
here

(defun isbn--char-to-int (c)
  "Convert a char C into the integer it displays, e.g. 9 for ?9."
  (- c ?0) )

does that mean I should change that into ditto number on
might wonder?

  https://dataswamp.org/~incal/emacs-init/isbn-verify.el

There is also the mention of "digit" all the time ... but
that's in the Emacs regexps so can't be all bad. The word
"bit" = "binary digit" BTW, not ditto "in----r" as many
people think.

But the `pi' isn't pi in Emacs anymore but `float-pi'!

(defun roll-out (chainring sprocket bsd tire)
  (let*((diameter (+ bsd (* 2 tire)))
        (circum   (* diameter float-pi))
        (roll-out (* (/ chainring sprocket 1.0) circum)) )
    (list chainring sprocket roll-out) ))
;; (roll-out 34 25 622 23) ; (34 25 2854.0740906720002)

  https://dataswamp.org/~incal/emacs-init/bike.el

Here, BSD = Bead Seat Diameter.
<https://en.wikipedia.org/wiki/Bicycle_wheel>

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-22 19:50 ` Stephen Berman
  2021-09-22 21:04   ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2021-09-23  0:23   ` Hongyi Zhao
  2021-09-23  7:24     ` Stephen Berman
  1 sibling, 1 reply; 54+ messages in thread
From: Hongyi Zhao @ 2021-09-23  0:23 UTC (permalink / raw)
  To: Stephen Berman; +Cc: help-gnu-emacs

On Thu, Sep 23, 2021 at 3:50 AM Stephen Berman <stephen.berman@gmx.net> wrote:
>
> On Wed, 22 Sep 2021 22:28:28 +0800 Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
>
> > Today, I stumbled on this interesting discussion here [1]:
> >
> > --------------------
> > 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
> > --------------------
> >
> > I tried all the ELISP codes suggested there, and only found that the
> > following one is valid:
> >
> > C-M-% \b[0-9][0-9]\b return \,(1+ \#&)
> >
> > The other two can't do the trick:
> >
> > First one:
> >
> > (defun add-1-to-2-digits (b e)
> >   "add 1 to every 2 digit number in the region"
> >   (interactive "r")
> >   (goto-char b)
> >   (while (re-search-forward "\\b[0-9][0-9]\\b" e t)
> >     (replace-match (number-to-string (+ 1 (string-to-int (match-string 0)))))))
> >
> > Validating method:
> >
> > `M-:' input-the-above-code-here, RET, `M-x add-1-to-2-digits'.
> >
> > And the second:
> >
> > (while (re-search-forward "\\<[0-9][0-9]\\>" nil t) (let ((x
> > (match-string 0))) (delete-backward-char 2) (insert (format "%d" (1+
> > (string-to-int x))))))
> >
> > Validating method:
> >
> > `M-:' input-the-above-code-here, RET
> >
> > [1] https://stackoverflow.com/questions/2686593/emacs-adding-1-to-every-number-made-of-2-digits-inside-a-marked-region
> >
> > Any hints/comments/enhancements for these methods will be greatly appreciated?
>
> `string-to-int' was made obsolete long ago and removed in Emacs 26 (see
> NEWS.26); replace it with `string-to-number' in those code snippets and
> they'll work.

This one works:

(defun add-1-to-2-digits (b e)
  "add 1 to every 2 digit number in the region"
  (interactive "r")
  (goto-char b)
  (while (re-search-forward "\\b[0-9][0-9]\\b" e t)
    (replace-match (number-to-string (+ 1 (string-to-number
(match-string 0)))))))


This one does nothing:

(while (re-search-forward "\\<[0-9][0-9]\\>" nil t) (let ((x
(match-string 0))) (delete-backward-char 2) (insert (format "%d" (1+
(string-to-number x))))))

HZ



^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-22 20:38 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2021-09-23  0:42   ` Hongyi Zhao
  2021-09-23  0:46     ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-09-23  0:57     ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-09-23  8:02   ` Hongyi Zhao
  1 sibling, 2 replies; 54+ messages in thread
From: Hongyi Zhao @ 2021-09-23  0:42 UTC (permalink / raw)
  To: Emanuel Berg, help-gnu-emacs

On Thu, Sep 23, 2021 at 4:38 AM Emanuel Berg via Users list for the
GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:
>
> Hongyi Zhao wrote:
>
> > Today, I stumbled on this interesting discussion [...]
> >
> > 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 [...]
>
> When I was still classified as a human being I did something
> similar and thanks to Emacs and that professional approach to
> preparation that mini-expedition was concluded in
> a semi-successful state since there were several survivors.
>
> Here is the URL to the file but I also yank it last:
>
>   https://dataswamp.org/~incal/TENT
>
> tent                      2515
> sleeping bag              1215
> sleeping pad               880
> Trangia                    619
> comic book                 580
> pillow                     450
> science book               411
> drybag                     305
> thermos                    270
> powerbank 8000mAh          245
> water bottle               115
> toothpaste                 110
> piece of cloth (big)       100
> knife                       90
> sticky tape                 90
> deodorant                   75
> flashlight (3AAA)           73
> piece of cloth (small)      60
> flashlight (USB)            55
> vaseline                    50
> toothbrush                  15
> skin lotion                 13
> comb                        11
> spoon/fork                   9
> pill case                    9
> ------------------------------
>                           8365g
>
> (defun digits-sum ()
>   (interactive)
>   (save-excursion
>     (goto-char (point-min))
>     (let ((sum 0))
>       (while (forward-word)
>         (let ((number (number-at-point)))
>           (when number
>             (cl-incf sum number) )))
>       (message "%s" sum) )))
> (defalias 'di #'digits-sum)

`M-:' the above code with your data in scratch gives me the following
message in minibuffer:

[Trailing garbage following expression]

HZ



^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-23  0:42   ` Hongyi Zhao
@ 2021-09-23  0:46     ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-09-23  0:56       ` Hongyi Zhao
  2021-09-23  0:57     ` Emanuel Berg via Users list for the GNU Emacs text editor
  1 sibling, 1 reply; 54+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-09-23  0:46 UTC (permalink / raw)
  To: help-gnu-emacs

Hongyi Zhao wrote:

> `M-:' the above code with your data in scratch gives me the
> following message in minibuffer:
>
> [Trailing garbage following expression]

It is interactive so just do M-x ...

(re-search-forward "[[:digit:]]\\{2\\}" nil t)

Stick to the replace and match stuff when doing this as
otherwise it is easy to insert stuff and then get a hit on
that and so on ...

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-23  0:46     ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2021-09-23  0:56       ` Hongyi Zhao
  2021-09-23  2:06         ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 54+ messages in thread
From: Hongyi Zhao @ 2021-09-23  0:56 UTC (permalink / raw)
  To: Emanuel Berg, help-gnu-emacs

On Thu, Sep 23, 2021 at 8:47 AM Emanuel Berg via Users list for the
GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:
>
> Hongyi Zhao wrote:
>
> > `M-:' the above code with your data in scratch gives me the
> > following message in minibuffer:
> >
> > [Trailing garbage following expression]
>
> It is interactive so just do M-x ...
>
> (re-search-forward "[[:digit:]]\\{2\\}" nil t)

Still no so clear what's your meaning. The function you defined above
is named as `digits-sum' with an alias `di'. I can't see how this code
has anything to do with the ones you posted previously.

> Stick to the replace and match stuff when doing this as
> otherwise it is easy to insert stuff and then get a hit on
> that and so on ...
>
> --
> underground experts united
> https://dataswamp.org/~incal
>
>

HZ



^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-23  0:42   ` Hongyi Zhao
  2021-09-23  0:46     ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2021-09-23  0:57     ` Emanuel Berg via Users list for the GNU Emacs text editor
  1 sibling, 0 replies; 54+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-09-23  0:57 UTC (permalink / raw)
  To: help-gnu-emacs

>>> Today, I stumbled on this interesting discussion [...]
>>>
>>> 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

Elispers have not been so much into MVC and such models
because it is understood that the buffer is a data structure
in its own right which is practical, that said some people
will say the right way to do this is to iterate the whole file
and make a list of all the values, the do
set/aggregate/higher-order on that to get a modified or new
list, and finally iterate that printing the result somewhere
else. Are the guys who say that right? The discussion can go
either and both ways ...

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-23  0:56       ` Hongyi Zhao
@ 2021-09-23  2:06         ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-09-23  2:12           ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 54+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-09-23  2:06 UTC (permalink / raw)
  To: help-gnu-emacs

Hongyi Zhao wrote:

>> (re-search-forward "[[:digit:]]\\{2\\}" nil t)
>
> Still no so clear what's your meaning. The function you
> defined above is named as `digits-sum' with an alias `di'.
> I can't see how this code has anything to do with the ones
> you posted previously.

This code has to do with the one you posted previously.

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-23  2:06         ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2021-09-23  2:12           ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 54+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-09-23  2:12 UTC (permalink / raw)
  To: help-gnu-emacs

>>> (re-search-forward "[[:digit:]]\\{2\\}" nil t)
>>
>> Still no so clear what's your meaning. The function you
>> defined above is named as `digits-sum' with an alias `di'.
>> I can't see how this code has anything to do with the ones
>> you posted previously.
>
> This code has to do with the one you posted previously.

It is more idiomatic. Character class and the repitition
postfix operator. Casca, Farnese and Schierke. Beat us if
you can.

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-23  0:23   ` Hongyi Zhao
@ 2021-09-23  7:24     ` Stephen Berman
  2021-09-23  7:54       ` Hongyi Zhao
  0 siblings, 1 reply; 54+ messages in thread
From: Stephen Berman @ 2021-09-23  7:24 UTC (permalink / raw)
  To: Hongyi Zhao; +Cc: help-gnu-emacs

On Thu, 23 Sep 2021 08:23:26 +0800 Hongyi Zhao <hongyi.zhao@gmail.com> wrote:

> On Thu, Sep 23, 2021 at 3:50 AM Stephen Berman <stephen.berman@gmx.net> wrote:
>>
>> On Wed, 22 Sep 2021 22:28:28 +0800 Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
>>
>> > Today, I stumbled on this interesting discussion here [1]:
>> >
>> > --------------------
>> > 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 one does nothing:
>
> (while (re-search-forward "\\<[0-9][0-9]\\>" nil t) (let ((x
> (match-string 0))) (delete-backward-char 2) (insert (format "%d" (1+
> (string-to-number x))))))

It works for me.  How exactly did you use it?

Steve Berman



^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-23  7:24     ` Stephen Berman
@ 2021-09-23  7:54       ` Hongyi Zhao
  2021-09-23  8:07         ` Stephen Berman
  0 siblings, 1 reply; 54+ messages in thread
From: Hongyi Zhao @ 2021-09-23  7:54 UTC (permalink / raw)
  To: Stephen Berman; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1473 bytes --]

On Thu, Sep 23, 2021 at 3:24 PM Stephen Berman <stephen.berman@gmx.net> wrote:
>
> On Thu, 23 Sep 2021 08:23:26 +0800 Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
>
> > On Thu, Sep 23, 2021 at 3:50 AM Stephen Berman <stephen.berman@gmx.net> wrote:
> >>
> >> On Wed, 22 Sep 2021 22:28:28 +0800 Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
> >>
> >> > Today, I stumbled on this interesting discussion here [1]:
> >> >
> >> > --------------------
> >> > 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 one does nothing:
> >
> > (while (re-search-forward "\\<[0-9][0-9]\\>" nil t) (let ((x
> > (match-string 0))) (delete-backward-char 2) (insert (format "%d" (1+
> > (string-to-number x))))))
>
> It works for me.  How exactly did you use it?

Mark set the following in scratch buffer:

some    34
word    30

M-: (while (re-search-forward "[[:digit:]]\\{2\\}" nil t) (let ((x
 (match-string 0))) (delete-backward-char 2) (insert (format "%d" (1+
 (string-to-number x)))))) RET

Please see the screenshot of the running results on my machine in the
attachment.

HZ

[-- Attachment #2: 001.png --]
[-- Type: image/png, Size: 50098 bytes --]

[-- Attachment #3: 002.png --]
[-- Type: image/png, Size: 37684 bytes --]

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-22 20:38 ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-09-23  0:42   ` Hongyi Zhao
@ 2021-09-23  8:02   ` Hongyi Zhao
  1 sibling, 0 replies; 54+ messages in thread
From: Hongyi Zhao @ 2021-09-23  8:02 UTC (permalink / raw)
  To: Emanuel Berg, help-gnu-emacs

On Thu, Sep 23, 2021 at 4:38 AM Emanuel Berg via Users list for the
GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:
>
> Hongyi Zhao wrote:
>
> > Today, I stumbled on this interesting discussion [...]
> >
> > 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 [...]
>
> When I was still classified as a human being

What do you mean by saying this?

> I did something
> similar and thanks to Emacs and that professional approach to
> preparation that mini-expedition was concluded in
> a semi-successful state since there were several survivors.
>
> Here is the URL to the file but I also yank it last:
>
>   https://dataswamp.org/~incal/TENT
>
> tent                      2515
> sleeping bag              1215
> sleeping pad               880
> Trangia                    619
> comic book                 580
> pillow                     450
> science book               411
> drybag                     305
> thermos                    270
> powerbank 8000mAh          245
> water bottle               115
> toothpaste                 110
> piece of cloth (big)       100
> knife                       90
> sticky tape                 90
> deodorant                   75
> flashlight (3AAA)           73
> piece of cloth (small)      60
> flashlight (USB)            55
> vaseline                    50
> toothbrush                  15
> skin lotion                 13
> comb                        11
> spoon/fork                   9
> pill case                    9
> ------------------------------
>                           8365g
>
> (defun digits-sum ()
>   (interactive)
>   (save-excursion
>     (goto-char (point-min))
>     (let ((sum 0))
>       (while (forward-word)
>         (let ((number (number-at-point)))
>           (when number
>             (cl-incf sum number) )))
>       (message "%s" sum) )))
> (defalias 'di #'digits-sum)
>
> -------------------------------------------------------------------------------
>
>                   https://dataswamp.org/~incal/TENT
>
> --
> underground experts united
> https://dataswamp.org/~incal



^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-23  7:54       ` Hongyi Zhao
@ 2021-09-23  8:07         ` Stephen Berman
  2021-09-23  9:00           ` Hongyi Zhao
  0 siblings, 1 reply; 54+ messages in thread
From: Stephen Berman @ 2021-09-23  8:07 UTC (permalink / raw)
  To: Hongyi Zhao; +Cc: help-gnu-emacs

On Thu, 23 Sep 2021 15:54:19 +0800 Hongyi Zhao <hongyi.zhao@gmail.com> wrote:

> On Thu, Sep 23, 2021 at 3:24 PM Stephen Berman <stephen.berman@gmx.net> wrote:
>>
>> On Thu, 23 Sep 2021 08:23:26 +0800 Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
>>
>> > On Thu, Sep 23, 2021 at 3:50 AM Stephen Berman <stephen.berman@gmx.net> wrote:
>> >>
>> >> On Wed, 22 Sep 2021 22:28:28 +0800 Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
>> >>
>> >> > Today, I stumbled on this interesting discussion here [1]:
>> >> >
>> >> > --------------------
>> >> > 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 one does nothing:
>> >
>> > (while (re-search-forward "\\<[0-9][0-9]\\>" nil t) (let ((x
>> > (match-string 0))) (delete-backward-char 2) (insert (format "%d" (1+
>> > (string-to-number x))))))
>>
>> It works for me.  How exactly did you use it?
>
> Mark set the following in scratch buffer:
>
> some    34
> word    30
>
> M-: (while (re-search-forward "[[:digit:]]\\{2\\}" nil t) (let ((x
>  (match-string 0))) (delete-backward-char 2) (insert (format "%d" (1+
>  (string-to-number x)))))) RET
>
> Please see the screenshot of the running results on my machine in the
> attachment.

In your first screenshot it looks like point in *scratch* is after the
number 30 when you evaluate the while-sexp.  Make sure point is before
34 and then it should work.

Steve Berman



^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-22 14:28 Emacs: adding 1 to every number made of 2 digits inside a marked region Hongyi Zhao
  2021-09-22 19:50 ` Stephen Berman
  2021-09-22 20:38 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2021-09-23  8:37 ` Andreas Röhler
  2021-09-23  9:05   ` Hongyi Zhao
  2021-09-23  9:58   ` Hongyi Zhao
  2021-09-23  9:26 ` Gregory Heytings
                   ` (2 subsequent siblings)
  5 siblings, 2 replies; 54+ messages in thread
From: Andreas Röhler @ 2021-09-23  8:37 UTC (permalink / raw)
  To: help-gnu-emacs

https://github.com/andreas-roehler/numbers-at-point

comes with

ar-raise-in-region-maybe

which should do the trick.

Cheers,

Andreas


On 22.09.21 16:28, Hongyi Zhao wrote:
> Today, I stumbled on this interesting discussion here [1]:
>
> --------------------
> 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
> --------------------
>
> I tried all the ELISP codes suggested there, and only found that the
> following one is valid:
>
> C-M-% \b[0-9][0-9]\b return \,(1+ \#&)
>
> The other two can't do the trick:
>
> First one:
>
> (defun add-1-to-2-digits (b e)
>    "add 1 to every 2 digit number in the region"
>    (interactive "r")
>    (goto-char b)
>    (while (re-search-forward "\\b[0-9][0-9]\\b" e t)
>      (replace-match (number-to-string (+ 1 (string-to-int (match-string 0)))))))
>
> Validating method:
>
> `M-:' input-the-above-code-here, RET, `M-x add-1-to-2-digits'.
>
> And the second:
>
> (while (re-search-forward "\\<[0-9][0-9]\\>" nil t) (let ((x
> (match-string 0))) (delete-backward-char 2) (insert (format "%d" (1+
> (string-to-int x))))))
>
> Validating method:
>
> `M-:' input-the-above-code-here, RET
>
> [1] https://stackoverflow.com/questions/2686593/emacs-adding-1-to-every-number-made-of-2-digits-inside-a-marked-region
>
> Any hints/comments/enhancements for these methods will be greatly appreciated?
>
> Regards



^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-23  8:07         ` Stephen Berman
@ 2021-09-23  9:00           ` Hongyi Zhao
  2021-09-23 10:07             ` Stephen Berman
  0 siblings, 1 reply; 54+ messages in thread
From: Hongyi Zhao @ 2021-09-23  9:00 UTC (permalink / raw)
  To: Stephen Berman; +Cc: help-gnu-emacs

On Thu, Sep 23, 2021 at 4:07 PM Stephen Berman <stephen.berman@gmx.net> wrote:
>
> On Thu, 23 Sep 2021 15:54:19 +0800 Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
>
> > On Thu, Sep 23, 2021 at 3:24 PM Stephen Berman <stephen.berman@gmx.net> wrote:
> >>
> >> On Thu, 23 Sep 2021 08:23:26 +0800 Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
> >>
> >> > On Thu, Sep 23, 2021 at 3:50 AM Stephen Berman <stephen.berman@gmx.net> wrote:
> >> >>
> >> >> On Wed, 22 Sep 2021 22:28:28 +0800 Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
> >> >>
> >> >> > Today, I stumbled on this interesting discussion here [1]:
> >> >> >
> >> >> > --------------------
> >> >> > 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 one does nothing:
> >> >
> >> > (while (re-search-forward "\\<[0-9][0-9]\\>" nil t) (let ((x
> >> > (match-string 0))) (delete-backward-char 2) (insert (format "%d" (1+
> >> > (string-to-number x))))))
> >>
> >> It works for me.  How exactly did you use it?
> >
> > Mark set the following in scratch buffer:
> >
> > some    34
> > word    30
> >
> > M-: (while (re-search-forward "[[:digit:]]\\{2\\}" nil t) (let ((x
> >  (match-string 0))) (delete-backward-char 2) (insert (format "%d" (1+
> >  (string-to-number x)))))) RET
> >
> > Please see the screenshot of the running results on my machine in the
> > attachment.
>
> In your first screenshot it looks like point in *scratch* is after the
> number 30 when you evaluate the while-sexp.  Make sure point is before
> 34 and then it should work.

Exactly. Thank you for pointing this out. Then I do the following
testing in the scratch buffer:

some    30
word    31 *

*  This is the position of point.

M-:
(while (re-search-backward "[[:digit:]]\\{2\\}" nil t) (let ((x
 (match-string 0))) (delete-backward-char 2) (insert (format "%d" (1+
 (string-to-number x))))))

Then I obtained the following in scratch:

;; This buffer is for
tex100999897969594939291908988878685848382818079787776757473727170696867666564636261605958575655545352515049484746454443424140393837363534333231

Any hints for this strange result?

Best, HZ



^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-23  8:37 ` Andreas Röhler
@ 2021-09-23  9:05   ` Hongyi Zhao
  2021-09-23  9:58   ` Hongyi Zhao
  1 sibling, 0 replies; 54+ messages in thread
From: Hongyi Zhao @ 2021-09-23  9:05 UTC (permalink / raw)
  To: Andreas Röhler; +Cc: help-gnu-emacs

On Thu, Sep 23, 2021 at 4:38 PM Andreas Röhler
<andreas.roehler@easy-emacs.de> wrote:
>
> https://github.com/andreas-roehler/numbers-at-point
>
> comes with
>
> ar-raise-in-region-maybe
>
> which should do the trick.

Thank you for letting me know this package developed by you. I'll give it a try.

Best regards, HZ



^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-22 14:28 Emacs: adding 1 to every number made of 2 digits inside a marked region Hongyi Zhao
                   ` (2 preceding siblings ...)
  2021-09-23  8:37 ` Andreas Röhler
@ 2021-09-23  9:26 ` Gregory Heytings
  2021-09-23  9:53   ` Hongyi Zhao
  2021-09-23 11:50 ` Andreas Röhler
  2021-09-26 22:54 ` Michael Heerdegen
  5 siblings, 1 reply; 54+ messages in thread
From: Gregory Heytings @ 2021-09-23  9:26 UTC (permalink / raw)
  To: Hongyi Zhao; +Cc: help-gnu-emacs


>
> 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 ...



^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-23  9:26 ` Gregory Heytings
@ 2021-09-23  9:53   ` Hongyi Zhao
  2021-09-23 10:02     ` Gregory Heytings
  2021-09-23 14:13     ` [External] : " Drew Adams
  0 siblings, 2 replies; 54+ messages in thread
From: Hongyi Zhao @ 2021-09-23  9:53 UTC (permalink / raw)
  To: Gregory Heytings; +Cc: help-gnu-emacs

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



^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-23  8:37 ` Andreas Röhler
  2021-09-23  9:05   ` Hongyi Zhao
@ 2021-09-23  9:58   ` Hongyi Zhao
  2021-09-23 10:10     ` Gregory Heytings
  2021-09-23 11:59     ` Andreas Röhler
  1 sibling, 2 replies; 54+ messages in thread
From: Hongyi Zhao @ 2021-09-23  9:58 UTC (permalink / raw)
  To: Andreas Röhler; +Cc: help-gnu-emacs

On Thu, Sep 23, 2021 at 4:38 PM Andreas Röhler
<andreas.roehler@easy-emacs.de> wrote:
>
> https://github.com/andreas-roehler/numbers-at-point
>
> comes with
>
> ar-raise-in-region-maybe
>
> which should do the trick.

It really does the trick with the following configuration:

(use-package thingatpt-utils-core
  :straight (:host github :type git :repo "andreas-roehler/numbers-at-point")
  :config
  (load "numbers-at-point.el" nil t t))

But how to increase/decrease in steps that are not equal to 1?

HZ



^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-23  9:53   ` Hongyi Zhao
@ 2021-09-23 10:02     ` Gregory Heytings
  2021-09-23 14:13     ` [External] : " Drew Adams
  1 sibling, 0 replies; 54+ messages in thread
From: Gregory Heytings @ 2021-09-23 10:02 UTC (permalink / raw)
  To: Hongyi Zhao; +Cc: help-gnu-emacs


>> 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 :-)
>

It isn't.  When you type C-x ( you start defining a macro, you just do 
what you want to do on a single item (and it's WYSIWIG!), and you end your 
macro definition with C-x ).  Then you repeat it on the other items.



^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-23  9:00           ` Hongyi Zhao
@ 2021-09-23 10:07             ` Stephen Berman
  2021-09-23 10:13               ` Hongyi Zhao
  0 siblings, 1 reply; 54+ messages in thread
From: Stephen Berman @ 2021-09-23 10:07 UTC (permalink / raw)
  To: Hongyi Zhao; +Cc: help-gnu-emacs

On Thu, 23 Sep 2021 17:00:01 +0800 Hongyi Zhao <hongyi.zhao@gmail.com> wrote:

> On Thu, Sep 23, 2021 at 4:07 PM Stephen Berman <stephen.berman@gmx.net> wrote:
[...]
>> In your first screenshot it looks like point in *scratch* is after the
>> number 30 when you evaluate the while-sexp.  Make sure point is before
>> 34 and then it should work.
>
> Exactly. Thank you for pointing this out. Then I do the following
> testing in the scratch buffer:
>
> some    30
> word    31 *
>
> *  This is the position of point.
>
> M-:
> (while (re-search-backward "[[:digit:]]\\{2\\}" nil t) (let ((x
>  (match-string 0))) (delete-backward-char 2) (insert (format "%d" (1+
>  (string-to-number x))))))
>
> Then I obtained the following in scratch:
>
> ;; This buffer is for
> tex100999897969594939291908988878685848382818079787776757473727170696867666564636261605958575655545352515049484746454443424140393837363534333231
>
> Any hints for this strange result?

Since you're now searching backwards, you need to delete forwards to
retain the position of the numbers and you need to make sure point is in
front of the number that was just incremented before continuing the loop:

(while (re-search-backward "[[:digit:]]\\{2\\}" nil t)
  (let ((x (match-string 0))
	(pt (point)))
    (delete-char 2)
    (insert (format "%d" (1+ (string-to-number x))))
    (goto-char pt)))

Steve Berman



^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-23  9:58   ` Hongyi Zhao
@ 2021-09-23 10:10     ` Gregory Heytings
  2021-09-23 10:17       ` Hongyi Zhao
  2021-09-23 11:59     ` Andreas Röhler
  1 sibling, 1 reply; 54+ messages in thread
From: Gregory Heytings @ 2021-09-23 10:10 UTC (permalink / raw)
  To: Hongyi Zhao; +Cc: help-gnu-emacs


>
> 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.



^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-23 10:07             ` Stephen Berman
@ 2021-09-23 10:13               ` Hongyi Zhao
  2021-09-23 10:23                 ` Stephen Berman
  0 siblings, 1 reply; 54+ messages in thread
From: Hongyi Zhao @ 2021-09-23 10:13 UTC (permalink / raw)
  To: Stephen Berman; +Cc: help-gnu-emacs

On Thu, Sep 23, 2021 at 6:08 PM Stephen Berman <stephen.berman@gmx.net> wrote:
>
> On Thu, 23 Sep 2021 17:00:01 +0800 Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
>
> > On Thu, Sep 23, 2021 at 4:07 PM Stephen Berman <stephen.berman@gmx.net> wrote:
> [...]
> >> In your first screenshot it looks like point in *scratch* is after the
> >> number 30 when you evaluate the while-sexp.  Make sure point is before
> >> 34 and then it should work.
> >
> > Exactly. Thank you for pointing this out. Then I do the following
> > testing in the scratch buffer:
> >
> > some    30
> > word    31 *
> >
> > *  This is the position of point.
> >
> > M-:
> > (while (re-search-backward "[[:digit:]]\\{2\\}" nil t) (let ((x
> >  (match-string 0))) (delete-backward-char 2) (insert (format "%d" (1+
> >  (string-to-number x))))))
> >
> > Then I obtained the following in scratch:
> >
> > ;; This buffer is for
> > tex100999897969594939291908988878685848382818079787776757473727170696867666564636261605958575655545352515049484746454443424140393837363534333231
> >
> > Any hints for this strange result?
>
> Since you're now searching backwards, you need to delete forwards to
> retain the position of the numbers and you need to make sure point is in
> front of the number that was just incremented before continuing the loop:
>
> (while (re-search-backward "[[:digit:]]\\{2\\}" nil t)
>   (let ((x (match-string 0))
>         (pt (point)))
>     (delete-char 2)
>     (insert (format "%d" (1+ (string-to-number x))))
>     (goto-char pt)))

Tried but it does nothing.

HZ



^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-23 10:10     ` Gregory Heytings
@ 2021-09-23 10:17       ` Hongyi Zhao
  2021-09-23 13:08         ` Gregory Heytings
  0 siblings, 1 reply; 54+ messages in thread
From: Hongyi Zhao @ 2021-09-23 10:17 UTC (permalink / raw)
  To: Gregory Heytings; +Cc: help-gnu-emacs

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



^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-23 10:13               ` Hongyi Zhao
@ 2021-09-23 10:23                 ` Stephen Berman
  2021-09-23 12:58                   ` Hongyi Zhao
  0 siblings, 1 reply; 54+ messages in thread
From: Stephen Berman @ 2021-09-23 10:23 UTC (permalink / raw)
  To: Hongyi Zhao; +Cc: help-gnu-emacs

On Thu, 23 Sep 2021 18:13:08 +0800 Hongyi Zhao <hongyi.zhao@gmail.com> wrote:

> On Thu, Sep 23, 2021 at 6:08 PM Stephen Berman <stephen.berman@gmx.net> wrote:
>>
>> On Thu, 23 Sep 2021 17:00:01 +0800 Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
>>
>> > On Thu, Sep 23, 2021 at 4:07 PM Stephen Berman <stephen.berman@gmx.net> wrote:
>> [...]
>> >> In your first screenshot it looks like point in *scratch* is after the
>> >> number 30 when you evaluate the while-sexp.  Make sure point is before
>> >> 34 and then it should work.
>> >
>> > Exactly. Thank you for pointing this out. Then I do the following
>> > testing in the scratch buffer:
>> >
>> > some    30
>> > word    31 *
>> >
>> > *  This is the position of point.
>> >
>> > M-:
>> > (while (re-search-backward "[[:digit:]]\\{2\\}" nil t) (let ((x
>> >  (match-string 0))) (delete-backward-char 2) (insert (format "%d" (1+
>> >  (string-to-number x))))))
>> >
>> > Then I obtained the following in scratch:
>> >
>> > ;; This buffer is for
>> > tex100999897969594939291908988878685848382818079787776757473727170696867666564636261605958575655545352515049484746454443424140393837363534333231
>> >
>> > Any hints for this strange result?
>>
>> Since you're now searching backwards, you need to delete forwards to
>> retain the position of the numbers and you need to make sure point is in
>> front of the number that was just incremented before continuing the loop:
>>
>> (while (re-search-backward "[[:digit:]]\\{2\\}" nil t)
>>   (let ((x (match-string 0))
>>         (pt (point)))
>>     (delete-char 2)
>>     (insert (format "%d" (1+ (string-to-number x))))
>>     (goto-char pt)))
>
> Tried but it does nothing.

Since you're now searching backwards, are you sure you had point *after*
the numbers?  I.e., if this is the *scratch* buffer:

-------------------------------------------------------
;; some    35
;; word    31
;; another 39
;; thing   60
;; to      40
;; say     11
;; here    48

(while (re-search-backward "[[:digit:]]\\{2\\}" nil t)
  (let ((x (match-string 0))
	(pt (point)))
    (delete-char 2)
    (insert (format "%d" (1+ (string-to-number x))))
    (goto-char pt)))
-------------------------------------------------------

then put the cursor at the end of the sexp and type `C-x C-e'.

Steve Berman



^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-22 14:28 Emacs: adding 1 to every number made of 2 digits inside a marked region Hongyi Zhao
                   ` (3 preceding siblings ...)
  2021-09-23  9:26 ` Gregory Heytings
@ 2021-09-23 11:50 ` Andreas Röhler
  2021-09-26 22:54 ` Michael Heerdegen
  5 siblings, 0 replies; 54+ messages in thread
From: Andreas Röhler @ 2021-09-23 11:50 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

https://github.com/andreas-roehler/numbers-at-point

comes with

ar-raise-in-region-maybe

which should do the trick.

Cheers,

Andreas

On 22.09.21 16:28, Hongyi Zhao wrote:
> Today, I stumbled on this interesting discussion here [1]:
>
> --------------------
> 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
> --------------------
>
> I tried all the ELISP codes suggested there, and only found that the
> following one is valid:
>
> C-M-% \b[0-9][0-9]\b return \,(1+ \#&)
>
> The other two can't do the trick:
>
> First one:
>
> (defun add-1-to-2-digits (b e)
>    "add 1 to every 2 digit number in the region"
>    (interactive "r")
>    (goto-char b)
>    (while (re-search-forward "\\b[0-9][0-9]\\b" e t)
>      (replace-match (number-to-string (+ 1 (string-to-int (match-string 0)))))))
>
> Validating method:
>
> `M-:' input-the-above-code-here, RET, `M-x add-1-to-2-digits'.
>
> And the second:
>
> (while (re-search-forward "\\<[0-9][0-9]\\>" nil t) (let ((x
> (match-string 0))) (delete-backward-char 2) (insert (format "%d" (1+
> (string-to-int x))))))
>
> Validating method:
>
> `M-:' input-the-above-code-here, RET
>
> [1] https://stackoverflow.com/questions/2686593/emacs-adding-1-to-every-number-made-of-2-digits-inside-a-marked-region
>
> Any hints/comments/enhancements for these methods will be greatly appreciated?
>
> Regards



^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-23  9:58   ` Hongyi Zhao
  2021-09-23 10:10     ` Gregory Heytings
@ 2021-09-23 11:59     ` Andreas Röhler
  2021-09-23 13:14       ` Hongyi Zhao
  1 sibling, 1 reply; 54+ messages in thread
From: Andreas Röhler @ 2021-09-23 11:59 UTC (permalink / raw)
  To: Hongyi Zhao; +Cc: help-gnu-emacs

On 23.09.21 11:58, Hongyi Zhao wrote:
> On Thu, Sep 23, 2021 at 4:38 PM Andreas Röhler
> <andreas.roehler@easy-emacs.de> wrote:
>> https://github.com/andreas-roehler/numbers-at-point
>>
>> comes with
>>
>> ar-raise-in-region-maybe
>>
>> which should do the trick.
> It really does the trick with the following configuration:
>
> (use-package thingatpt-utils-core
>    :straight (:host github :type git :repo "andreas-roehler/numbers-at-point")
>    :config
>    (load "numbers-at-point.el" nil t t))
>
> But how to increase/decrease in steps that are not equal to 1?
>
> HZ


It takes a numerical argument for higher steps the common way:

M-[STEP] ar-raise-in-region-maybe RET




^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-23 10:23                 ` Stephen Berman
@ 2021-09-23 12:58                   ` Hongyi Zhao
  2021-09-23 13:29                     ` Stephen Berman
  0 siblings, 1 reply; 54+ messages in thread
From: Hongyi Zhao @ 2021-09-23 12:58 UTC (permalink / raw)
  To: Stephen Berman; +Cc: help-gnu-emacs

On Thu, Sep 23, 2021 at 6:23 PM Stephen Berman <stephen.berman@gmx.net> wrote:
[...]
> > Tried but it does nothing.
>
> Since you're now searching backwards, are you sure you had point *after*
> the numbers?  I.e., if this is the *scratch* buffer:
>
> -------------------------------------------------------
> ;; some    35
> ;; word    31
> ;; another 39
> ;; thing   60
> ;; to      40
> ;; say     11
> ;; here    48
>
> (while (re-search-backward "[[:digit:]]\\{2\\}" nil t)
>   (let ((x (match-string 0))
>         (pt (point)))
>     (delete-char 2)
>     (insert (format "%d" (1+ (string-to-number x))))
>     (goto-char pt)))
> -------------------------------------------------------
>
> then put the cursor at the end of the sexp and type `C-x C-e'.

This way works. But the invalid method I tried before is as follows:

 Select the data block and put the point at the end of it in scratch,
then `M-:' the above code in minibuffer. With this method, I only the
following message generated in minibuffer:

Mark set
nil

Best, HZ



^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-23 10:17       ` Hongyi Zhao
@ 2021-09-23 13:08         ` Gregory Heytings
  0 siblings, 0 replies; 54+ messages in thread
From: Gregory Heytings @ 2021-09-23 13:08 UTC (permalink / raw)
  To: Hongyi Zhao; +Cc: help-gnu-emacs


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

Is this not what I already did?



^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-23 11:59     ` Andreas Röhler
@ 2021-09-23 13:14       ` Hongyi Zhao
  2021-09-23 13:51         ` Andreas Röhler
  0 siblings, 1 reply; 54+ messages in thread
From: Hongyi Zhao @ 2021-09-23 13:14 UTC (permalink / raw)
  To: Andreas Röhler; +Cc: help-gnu-emacs

On Thu, Sep 23, 2021 at 7:59 PM Andreas Röhler
<andreas.roehler@easy-emacs.de> wrote:
>
> On 23.09.21 11:58, Hongyi Zhao wrote:
> > On Thu, Sep 23, 2021 at 4:38 PM Andreas Röhler
> > <andreas.roehler@easy-emacs.de> wrote:
> >> https://github.com/andreas-roehler/numbers-at-point
> >>
> >> comes with
> >>
> >> ar-raise-in-region-maybe
> >>
> >> which should do the trick.
> > It really does the trick with the following configuration:
> >
> > (use-package thingatpt-utils-core
> >    :straight (:host github :type git :repo "andreas-roehler/numbers-at-point")
> >    :config
> >    (load "numbers-at-point.el" nil t t))
> >
> > But how to increase/decrease in steps that are not equal to 1?
> >
> > HZ
>
>
> It takes a numerical argument for higher steps the common way:
>
> M-[STEP] ar-raise-in-region-maybe RET

It should be used as follows: First select/mark the data region and
place the point at the end of it, then perform the following
operation:

M-[STEP] M-x ar-raise-in-region-maybe RET,

e.g., use 2 as the step,

M-2 M-x ar-raise-in-region-maybe RET

Best regards, HZ



^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-23 12:58                   ` Hongyi Zhao
@ 2021-09-23 13:29                     ` Stephen Berman
  2021-09-23 14:25                       ` Hongyi Zhao
  0 siblings, 1 reply; 54+ messages in thread
From: Stephen Berman @ 2021-09-23 13:29 UTC (permalink / raw)
  To: Hongyi Zhao; +Cc: help-gnu-emacs

On Thu, 23 Sep 2021 20:58:49 +0800 Hongyi Zhao <hongyi.zhao@gmail.com> wrote:

> On Thu, Sep 23, 2021 at 6:23 PM Stephen Berman <stephen.berman@gmx.net> wrote:
> [...]
>> > Tried but it does nothing.
>>
>> Since you're now searching backwards, are you sure you had point *after*
>> the numbers?  I.e., if this is the *scratch* buffer:
>>
>> -------------------------------------------------------
>> ;; some    35
>> ;; word    31
>> ;; another 39
>> ;; thing   60
>> ;; to      40
>> ;; say     11
>> ;; here    48
>>
>> (while (re-search-backward "[[:digit:]]\\{2\\}" nil t)
>>   (let ((x (match-string 0))
>>         (pt (point)))
>>     (delete-char 2)
>>     (insert (format "%d" (1+ (string-to-number x))))
>>     (goto-char pt)))
>> -------------------------------------------------------
>>
>> then put the cursor at the end of the sexp and type `C-x C-e'.
>
> This way works. But the invalid method I tried before is as follows:
>
>  Select the data block and put the point at the end of it in scratch,
> then `M-:' the above code in minibuffer. With this method, I only the
> following message generated in minibuffer:
>
> Mark set
> nil

If by selecting the data block you mean: (with emacs -Q) putting point
before the start of the block, typing `C-SPC', then moving point to the
end of the block: that works for me, so I don't know why it doesn't work
you.

Steve Berman



^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-23 13:14       ` Hongyi Zhao
@ 2021-09-23 13:51         ` Andreas Röhler
  2021-09-23 14:23           ` Hongyi Zhao
  0 siblings, 1 reply; 54+ messages in thread
From: Andreas Röhler @ 2021-09-23 13:51 UTC (permalink / raw)
  To: Hongyi Zhao; +Cc: help-gnu-emacs


On 23.09.21 15:14, Hongyi Zhao wrote:
> On Thu, Sep 23, 2021 at 7:59 PM Andreas Röhler
> <andreas.roehler@easy-emacs.de> wrote:
>> On 23.09.21 11:58, Hongyi Zhao wrote:
>>> On Thu, Sep 23, 2021 at 4:38 PM Andreas Röhler
>>> <andreas.roehler@easy-emacs.de> wrote:
>>>> https://github.com/andreas-roehler/numbers-at-point
>>>>
>>>> comes with
>>>>
>>>> ar-raise-in-region-maybe
>>>>
>>>> which should do the trick.
>>> It really does the trick with the following configuration:
>>>
>>> (use-package thingatpt-utils-core
>>>     :straight (:host github :type git :repo "andreas-roehler/numbers-at-point")
>>>     :config
>>>     (load "numbers-at-point.el" nil t t))
>>>
>>> But how to increase/decrease in steps that are not equal to 1?
>>>
>>> HZ
>>
>> It takes a numerical argument for higher steps the common way:
>>
>> M-[STEP] ar-raise-in-region-maybe RET
> It should be used as follows: First select/mark the data region and
> place the point at the end of it, then perform the following
> operation:
>
> M-[STEP] M-x ar-raise-in-region-maybe RET,
>
> e.g., use 2 as the step,
>
> M-2 M-x ar-raise-in-region-maybe RET
>
> Best regards, HZ


Hmm, in fact current behavior doesn't care if at the beginning or the 
end of a region.






^ permalink raw reply	[flat|nested] 54+ messages in thread

* RE: [External] : Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-23  9:53   ` Hongyi Zhao
  2021-09-23 10:02     ` Gregory Heytings
@ 2021-09-23 14:13     ` Drew Adams
  2021-09-23 23:50       ` Emanuel Berg via Users list for the GNU Emacs text editor
  1 sibling, 1 reply; 54+ messages in thread
From: Drew Adams @ 2021-09-23 14:13 UTC (permalink / raw)
  To: Hongyi Zhao, Gregory Heytings; +Cc: help-gnu-emacs

> > This is a typical job for a macro.
> > 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 :-)

It's not.  Just record the keystrokes you use to
make one change, then replay the recording.

Just make sure to start and end your recording
at places that allow it to do the right thing
when repeated.

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-23 13:51         ` Andreas Röhler
@ 2021-09-23 14:23           ` Hongyi Zhao
  0 siblings, 0 replies; 54+ messages in thread
From: Hongyi Zhao @ 2021-09-23 14:23 UTC (permalink / raw)
  To: Andreas Röhler; +Cc: help-gnu-emacs

On Thu, Sep 23, 2021 at 9:51 PM Andreas Röhler
<andreas.roehler@easy-emacs.de> wrote:
>
>
> On 23.09.21 15:14, Hongyi Zhao wrote:
> > On Thu, Sep 23, 2021 at 7:59 PM Andreas Röhler
> > <andreas.roehler@easy-emacs.de> wrote:
> >> On 23.09.21 11:58, Hongyi Zhao wrote:
> >>> On Thu, Sep 23, 2021 at 4:38 PM Andreas Röhler
> >>> <andreas.roehler@easy-emacs.de> wrote:
> >>>> https://github.com/andreas-roehler/numbers-at-point
> >>>>
> >>>> comes with
> >>>>
> >>>> ar-raise-in-region-maybe
> >>>>
> >>>> which should do the trick.
> >>> It really does the trick with the following configuration:
> >>>
> >>> (use-package thingatpt-utils-core
> >>>     :straight (:host github :type git :repo "andreas-roehler/numbers-at-point")
> >>>     :config
> >>>     (load "numbers-at-point.el" nil t t))
> >>>
> >>> But how to increase/decrease in steps that are not equal to 1?
> >>>
> >>> HZ
> >>
> >> It takes a numerical argument for higher steps the common way:
> >>
> >> M-[STEP] ar-raise-in-region-maybe RET
> > It should be used as follows: First select/mark the data region and
> > place the point at the end of it, then perform the following
> > operation:
> >
> > M-[STEP] M-x ar-raise-in-region-maybe RET,
> >
> > e.g., use 2 as the step,
> >
> > M-2 M-x ar-raise-in-region-maybe RET
> >
> > Best regards, HZ
>
>
> Hmm, in fact current behavior doesn't care if at the beginning or the
> end of a region.

Confirmed. Thanks for telling me this behavior.

HZ



^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-23 13:29                     ` Stephen Berman
@ 2021-09-23 14:25                       ` Hongyi Zhao
  0 siblings, 0 replies; 54+ messages in thread
From: Hongyi Zhao @ 2021-09-23 14:25 UTC (permalink / raw)
  To: Stephen Berman; +Cc: help-gnu-emacs

On Thu, Sep 23, 2021 at 9:29 PM Stephen Berman <stephen.berman@gmx.net> wrote:
> If by selecting the data block you mean: (with emacs -Q) putting point
> before the start of the block, typing `C-SPC', then moving point to the
> end of the block:

Exactly. That's what I did.

> that works for me, so I don't know why it doesn't work you.

HZ



^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [External] : Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-23 14:13     ` [External] : " Drew Adams
@ 2021-09-23 23:50       ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-09-24  0:23         ` Drew Adams
  2021-09-24  7:25         ` Gregory Heytings
  0 siblings, 2 replies; 54+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-09-23 23:50 UTC (permalink / raw)
  To: help-gnu-emacs

Drew Adams wrote:

>>> This is a typical job for a macro.
>>> 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 :-)
>
> It's not.  Just record the keystrokes you use to
> make one change, then replay the recording.

Poor man's programming, don't encourage him to start with
that :)

This is a very simple task to solve with Elisp and the problem
with the point position is easily solved by either putting the
point at the correct position before invocation (this method
allows for bigger flexibility) _or_ but using
`save-mark-and-excursion' and `goto-char' to put point at
`point-min'.

This is also a good candidate for a DWIM interface:

(defun test-dwim (&optional beg end)
  (interactive (when (use-region-p)
                 (list (region-beginning) (region-end)) ))
  (let ((bg (or beg (point-min))) ; or just (point) here
        (ed (or end (point-max))) )
    (list bg ed) ; code here
    ))

If you get the point ...

https://dataswamp.org/~incal/emacs-init/dwim.el

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 54+ messages in thread

* RE: [External] : Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-23 23:50       ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2021-09-24  0:23         ` Drew Adams
  2021-09-24  2:34           ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-09-24  7:25         ` Gregory Heytings
  1 sibling, 1 reply; 54+ messages in thread
From: Drew Adams @ 2021-09-24  0:23 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: 'Help-Gnu-Emacs (help-gnu-emacs@gnu.org)'

[-- Attachment #1: Type: text/plain, Size: 602 bytes --]

> > Just record the keystrokes you use to
> > make one change, then replay the recording.
> 
> Poor man's programming, don't encourage him to start with
> that :)

Poor man tools are sometimes useful for poor and
rich men.

1. Even for someone with good Elisp skills, a
keyboard macro is sometimes preferable as a one-off.
My guess is that most uses of keyboard macros are
for one-off tasks.

2. Getting used to using keyboard macros can help
someone get to know other Emacs features and ways
to use Emacs.  Telling someone not to use them is
like telling them not to use arrow keys.

[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 13522 bytes --]

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [External] : Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-24  0:23         ` Drew Adams
@ 2021-09-24  2:34           ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-09-24  3:01             ` Drew Adams
  0 siblings, 1 reply; 54+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-09-24  2:34 UTC (permalink / raw)
  To: help-gnu-emacs

Drew Adams wrote:

>>> Just record the keystrokes you use to make one change,
>>> then replay the recording.
>> 
>> Poor man's programming, don't encourage him to start with
>> that :)
>
> Poor man tools are sometimes useful for poor and rich men.
>
> 1. Even for someone with good Elisp skills, a keyboard macro
>    is sometimes preferable as a one-off. My guess is that
>    most uses of keyboard macros are for one-off tasks.

Yes, but you don't know that and in my experience one-off
tasks are just one-off the first time you do them ...

Even if the problem don't reappear exactly the same way -
which it often does - a variation of the problem is very
likely to and then you can just provide other arguments and/or
slightly modify your Elisp ...

And note that the distance between the variations can be quite
big and this does not translate linearly to how much you have
to change your Elisp. On the contrary, not the least since
a lot of Elisp time (and programming time in general) is just
routinely writing the same old stuff over and over.
So interestingly, the more Elisp you write, the less you have
to :)

> 2. Getting used to using keyboard macros can help someone
>    get to know other Emacs features and ways to use Emacs.
>    Telling someone not to use them is like telling them not
>    to use arrow keys.

But What's wrong with telling people that?

Okay, bad example ...

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 54+ messages in thread

* RE: [External] : Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-24  2:34           ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2021-09-24  3:01             ` Drew Adams
  0 siblings, 0 replies; 54+ messages in thread
From: Drew Adams @ 2021-09-24  3:01 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: 'Help-Gnu-Emacs (help-gnu-emacs@gnu.org)'

[-- Attachment #1: Type: text/plain, Size: 2178 bytes --]

> > 1. Even for someone with good Elisp skills, a keyboard macro
> >    is sometimes preferable as a one-off. My guess is that
> >    most uses of keyboard macros are for one-off tasks.
> 
> Yes, but you don't know that and in my experience one-off
> tasks are just one-off the first time you do them ...
> 
> Even if the problem don't reappear exactly the same way -
> which it often does - a variation of the problem is very
> likely to and then you can just provide other arguments and/or
> slightly modify your Elisp ...
> 
> And note that the distance between the variations can be quite
> big and this does not translate linearly to how much you have
> to change your Elisp. On the contrary, not the least since
> a lot of Elisp time (and programming time in general) is just
> routinely writing the same old stuff over and over.
> So interestingly, the more Elisp you write, the less you have
> to :)

I don't disagree with those points.

We're at a level of generality here that doesn't
help much, I think.  The advantages and uses you
cite are real.  That's not a reason that keyboard
macros shouldn't be used or should be avoided.
Both Lisp and keyboard macros are useful, even if
they can overlap in use and utility.
___

[
There used to be a command that translated a
keyboard macro to Lisp code, which you could then
edit to produce something more/different.  This
was more than what `insert-kbd-macro' does.
Instead of just a sequence of keys (strings) you
got Lisp code with command invocations, IIRC.

It was rudimentary, but interesting.  It could
be a way to learn some Elisp and even sometimes
a quick-and-dirty shortcut to producing some
skeletal code.  Mundane keys that a new lisper
might not be familiar with were written up as
their commands, letting you quickly put together
something in Lisp that "worked".  Maybe not the
best code, but something you could work with.

I think the command had "gen" or "generate" in
the name.  Googling just now, I came across
this (elmacro), but it's relatively recent,
whereas what I was talking about was quite old.

https://stackoverflow.com/q/1717569/729907
]

[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 14970 bytes --]

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [External] : Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-23 23:50       ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-09-24  0:23         ` Drew Adams
@ 2021-09-24  7:25         ` Gregory Heytings
  2021-09-24  7:32           ` Emanuel Berg via Users list for the GNU Emacs text editor
  1 sibling, 1 reply; 54+ messages in thread
From: Gregory Heytings @ 2021-09-24  7:25 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: help-gnu-emacs


>>>> This is a typical job for a macro.
>>>> 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 :-)
>>
>> It's not.  Just record the keystrokes you use to make one change, then 
>> replay the recording.
>
> Poor man's programming, don't encourage him to start with that :)
>

The OP was asking for opinions, mine is not worth less than yours. 
Apparently (I just looked at your init files) you do not use keyboard 
macros, which is of course fine, but they are one of the tools in Emacs' 
toolset.

My experience and opinion is that there are cases when it's faster to 
"just do it", and that this is one such case.  Using a macro for such a 
task is, again in my experience and opinion, much more efficient than 
finding / installing / understanding a package that does what you want, or 
writing / debugging / tweaking a defun.



^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [External] : Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-24  7:25         ` Gregory Heytings
@ 2021-09-24  7:32           ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 54+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-09-24  7:32 UTC (permalink / raw)
  To: help-gnu-emacs

Gregory Heytings wrote:

>> Poor man's programming, don't encourage him to start with that :)
>
> The OP was asking for opinions, mine is not worth less than
> yours. Apparently (I just looked at your init files) you do
> not use keyboard macros, which is of course fine, but they
> are one of the tools in Emacs' toolset.

Yeah, not saying it should be criminalized or anything ...

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-22 14:28 Emacs: adding 1 to every number made of 2 digits inside a marked region Hongyi Zhao
                   ` (4 preceding siblings ...)
  2021-09-23 11:50 ` Andreas Röhler
@ 2021-09-26 22:54 ` Michael Heerdegen
  2021-09-26 23:50   ` Arthur Miller
                     ` (2 more replies)
  5 siblings, 3 replies; 54+ messages in thread
From: Michael Heerdegen @ 2021-09-26 22:54 UTC (permalink / raw)
  To: Hongyi Zhao; +Cc: help-gnu-emacs

Hongyi Zhao <hongyi.zhao@gmail.com> writes:

> 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

You might want to give Calc a try for such things.  It doesn't perfectly
handle the editing part though since it doesn't know about rectangle
commands (AFAICT - at least for insertion).

So here is how I would do it:

- mark the rectangular region spanning the numbers
- `C-x * r': this will grab the number column as a matrix and pop up
  Calc
- `1 RET +': will add 1 to all entries

You now have the result as a matrix.  What you have to do now manually
using conventional rectangle commands is to kill the original numbers
from the buffer (they are already marked, so `C-x r k'), and then kill
and yank the numbers as rectangle from the Calc buffer.

Calc also allows to add numbers in a row or column in any buffer in a
similarly easy way.  The Calc tutorial has some examples doing such
things.

Michael.



^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-26 22:54 ` Michael Heerdegen
@ 2021-09-26 23:50   ` Arthur Miller
  2021-09-27  1:02   ` Arthur Miller
  2021-09-27  1:03   ` Arthur Miller
  2 siblings, 0 replies; 54+ messages in thread
From: Arthur Miller @ 2021-09-26 23:50 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: help-gnu-emacs, Hongyi Zhao

Michael Heerdegen <michael_heerdegen@web.de> writes:

> Hongyi Zhao <hongyi.zhao@gmail.com> writes:
>
>> 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
>
> You might want to give Calc a try for such things.  It doesn't perfectly
> handle the editing part though since it doesn't know about rectangle
> commands (AFAICT - at least for insertion).
>
> So here is how I would do it:
>
> - mark the rectangular region spanning the numbers
> - `C-x * r': this will grab the number column as a matrix and pop up
>   Calc
> - `1 RET +': will add 1 to all entries
>
> You now have the result as a matrix.  What you have to do now manually
> using conventional rectangle commands is to kill the original numbers
> from the buffer (they are already marked, so `C-x r k'), and then kill
> and yank the numbers as rectangle from the Calc buffer.
>
> Calc also allows to add numbers in a row or column in any buffer in a
> similarly easy way.  The Calc tutorial has some examples doing such
> things.
>
> Michael.

Org-table also comes to mind.

#+begin_src org-mode
|some    |34|
|word    |30|
|another |38|
|thing   |59|
|to      |39|
|say     |10|
|here    |47|
#+end_src



^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-26 22:54 ` Michael Heerdegen
  2021-09-26 23:50   ` Arthur Miller
@ 2021-09-27  1:02   ` Arthur Miller
  2021-09-27  1:22     ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-09-27  1:03   ` Arthur Miller
  2 siblings, 1 reply; 54+ messages in thread
From: Arthur Miller @ 2021-09-27  1:02 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: help-gnu-emacs, Hongyi Zhao

Michael Heerdegen <michael_heerdegen@web.de> writes:

> Hongyi Zhao <hongyi.zhao@gmail.com> writes:
>
>> 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
>
> You might want to give Calc a try for such things.  It doesn't perfectly
> handle the editing part though since it doesn't know about rectangle
> commands (AFAICT - at least for insertion).
>
> So here is how I would do it:
>
> - mark the rectangular region spanning the numbers
> - `C-x * r': this will grab the number column as a matrix and pop up
>   Calc
> - `1 RET +': will add 1 to all entries
>
> You now have the result as a matrix.  What you have to do now manually
> using conventional rectangle commands is to kill the original numbers
> from the buffer (they are already marked, so `C-x r k'), and then kill
> and yank the numbers as rectangle from the Calc buffer.
>
> Calc also allows to add numbers in a row or column in any buffer in a
> similarly easy way.  The Calc tutorial has some examples doing such
> things.
>
> Michael.

Oh ... sent previous before I was done, forgott I wasnn't in org-mode :-)

Anyway I am sorry for the noise. I thought it would be this easy:


| some    | 34 |  |
| word    | 30 |  |
| another | 38 |  |
| thing   | 59 |  |
| to      | 39 |  |
| say     | 10 |  |
| here    | 47 |  |
#+TBLFM: $3='(apply '1+ $2);N'



^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-26 22:54 ` Michael Heerdegen
  2021-09-26 23:50   ` Arthur Miller
  2021-09-27  1:02   ` Arthur Miller
@ 2021-09-27  1:03   ` Arthur Miller
  2021-09-27 14:08     ` Arthur Miller
  2 siblings, 1 reply; 54+ messages in thread
From: Arthur Miller @ 2021-09-27  1:03 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: help-gnu-emacs, Hongyi Zhao

Michael Heerdegen <michael_heerdegen@web.de> writes:

> Hongyi Zhao <hongyi.zhao@gmail.com> writes:
>
>> 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
>
> You might want to give Calc a try for such things.  It doesn't perfectly
> handle the editing part though since it doesn't know about rectangle
> commands (AFAICT - at least for insertion).
>
> So here is how I would do it:
>
> - mark the rectangular region spanning the numbers
> - `C-x * r': this will grab the number column as a matrix and pop up
>   Calc
> - `1 RET +': will add 1 to all entries
>
> You now have the result as a matrix.  What you have to do now manually
> using conventional rectangle commands is to kill the original numbers
> from the buffer (they are already marked, so `C-x r k'), and then kill
> and yank the numbers as rectangle from the Calc buffer.
>
> Calc also allows to add numbers in a row or column in any buffer in a
> similarly easy way.  The Calc tutorial has some examples doing such
> things.
>
> Michael.

And I was of course wrong :-)

And sent mail again by misstake ... :-)

Time for the sleep



^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-27  1:02   ` Arthur Miller
@ 2021-09-27  1:22     ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-09-27  5:57       ` Hongyi Zhao
  2021-09-27 10:59       ` Arthur Miller
  0 siblings, 2 replies; 54+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-09-27  1:22 UTC (permalink / raw)
  To: help-gnu-emacs

Arthur Miller wrote:

> | some    | 34 |  |
> | word    | 30 |  |
> | another | 38 |  |
> | thing   | 59 |  |
> | to      | 39 |  |
> | say     | 10 |  |
> | here    | 47 |  |

Her you go:

(defun inc-all (&optional beg end)
  (interactive (when (use-region-p)
                 (list (region-beginning) (region-end)) ))
  (let ((bg (or beg (point-min)))
        (ed (or end (point-max))) )
    (save-mark-and-excursion
      (goto-char bg)
      (while (re-search-forward "[[:digit:]]\\{2\\}" ed t)
        (replace-match
         (format "%d" (1+ (string-to-number (match-string 0)))) )))))

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-27  1:22     ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2021-09-27  5:57       ` Hongyi Zhao
  2021-09-28  1:32         ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-09-27 10:59       ` Arthur Miller
  1 sibling, 1 reply; 54+ messages in thread
From: Hongyi Zhao @ 2021-09-27  5:57 UTC (permalink / raw)
  To: Emanuel Berg, help-gnu-emacs

On Mon, Sep 27, 2021 at 9:22 AM Emanuel Berg via Users list for the
GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:
>
> Arthur Miller wrote:
>
> > | some    | 34 |  |
> > | word    | 30 |  |
> > | another | 38 |  |
> > | thing   | 59 |  |
> > | to      | 39 |  |
> > | say     | 10 |  |
> > | here    | 47 |  |

I'm still not so clear about the above method, especially, must I add
all the vertical bars to my original data for doing this operation and
then remove them again?

>
> Her you go:
>
> (defun inc-all (&optional beg end)
>   (interactive (when (use-region-p)
>                  (list (region-beginning) (region-end)) ))
>   (let ((bg (or beg (point-min)))
>         (ed (or end (point-max))) )
>     (save-mark-and-excursion
>       (goto-char bg)
>       (while (re-search-forward "[[:digit:]]\\{2\\}" ed t)
>         (replace-match
>          (format "%d" (1+ (string-to-number (match-string 0)))) )))))

Again, must the above code depend on vertical bars/lines in the data?

HZ



^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-27  1:22     ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-09-27  5:57       ` Hongyi Zhao
@ 2021-09-27 10:59       ` Arthur Miller
  2021-09-28  1:34         ` Emanuel Berg via Users list for the GNU Emacs text editor
  1 sibling, 1 reply; 54+ messages in thread
From: Arthur Miller @ 2021-09-27 10:59 UTC (permalink / raw)
  To: help-gnu-emacs

Emanuel Berg via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org> writes:

> Arthur Miller wrote:
>
>> | some    | 34 |  |
>> | word    | 30 |  |
>> | another | 38 |  |
>> | thing   | 59 |  |
>> | to      | 39 |  |
>> | say     | 10 |  |
>> | here    | 47 |  |
>
> Her you go:
>
> (defun inc-all (&optional beg end)
>   (interactive (when (use-region-p)
>                  (list (region-beginning) (region-end)) ))
>   (let ((bg (or beg (point-min)))
>         (ed (or end (point-max))) )
>     (save-mark-and-excursion
>       (goto-char bg)
>       (while (re-search-forward "[[:digit:]]\\{2\\}" ed t)
>         (replace-match
>          (format "%d" (1+ (string-to-number (match-string 0)))) )))))
Ah no, not really; you are parsing region, that is not what I wanted
there. There is org api to do this.



^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-27  1:03   ` Arthur Miller
@ 2021-09-27 14:08     ` Arthur Miller
  0 siblings, 0 replies; 54+ messages in thread
From: Arthur Miller @ 2021-09-27 14:08 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: help-gnu-emacs, Hongyi Zhao

Arthur Miller <arthur.miller@live.com> writes:

> Michael Heerdegen <michael_heerdegen@web.de> writes:
>
>> Hongyi Zhao <hongyi.zhao@gmail.com> writes:
>>
>>> 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
>>
>> You might want to give Calc a try for such things.  It doesn't perfectly
>> handle the editing part though since it doesn't know about rectangle
>> commands (AFAICT - at least for insertion).
>>
>> So here is how I would do it:
>>
>> - mark the rectangular region spanning the numbers
>> - `C-x * r': this will grab the number column as a matrix and pop up
>>   Calc
>> - `1 RET +': will add 1 to all entries
>>
>> You now have the result as a matrix.  What you have to do now manually
>> using conventional rectangle commands is to kill the original numbers
>> from the buffer (they are already marked, so `C-x r k'), and then kill
>> and yank the numbers as rectangle from the Calc buffer.
>>
>> Calc also allows to add numbers in a row or column in any buffer in a
>> similarly easy way.  The Calc tutorial has some examples doing such
>> things.
>>
>> Michael.
>
> And I was of course wrong :-)
>
> And sent mail again by misstake ... :-)
>
> Time for the sleep

With some help from the reddit:

| some    | 34 | 35 |
| word    | 30 | 31 |
| another | 38 | 39 |
| thing   | 59 | 60 |
| to      | 39 | 40 |
| say     | 10 | 11 |
| here    | 47 | 48 |
#+TBLFM: $3='(1+ '$2);N

It was even easier than I thought :).



^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-27  5:57       ` Hongyi Zhao
@ 2021-09-28  1:32         ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 54+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-09-28  1:32 UTC (permalink / raw)
  To: help-gnu-emacs

Hongyi Zhao wrote:

>> Her you go:
>>
>> (defun inc-all (&optional beg end)
>>   (interactive (when (use-region-p)
>>                  (list (region-beginning) (region-end)) ))
>>   (let ((bg (or beg (point-min)))
>>         (ed (or end (point-max))) )
>>     (save-mark-and-excursion
>>       (goto-char bg)
>>       (while (re-search-forward "[[:digit:]]\\{2\\}" ed t)
>>         (replace-match
>>          (format "%d" (1+ (string-to-number (match-string 0)))) )))))
>
> Again, must the above code depend on vertical bars/lines in
> the data?

No, as it searches for data matching this regular expression
"[[:digit:]]\\{2\\}" which doesn't include any vertical lines.

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-27 10:59       ` Arthur Miller
@ 2021-09-28  1:34         ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-09-28  1:51           ` Arthur Miller
  0 siblings, 1 reply; 54+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-09-28  1:34 UTC (permalink / raw)
  To: help-gnu-emacs

Arthur Miller wrote:

> Emanuel Berg via Users list for the GNU Emacs text editor
> <help-gnu-emacs@gnu.org> writes:
>
>> Arthur Miller wrote:
>>
>>> | some    | 34 |  |
>>> | word    | 30 |  |
>>> | another | 38 |  |
>>> | thing   | 59 |  |
>>> | to      | 39 |  |
>>> | say     | 10 |  |
>>> | here    | 47 |  |
>>
>> Her you go:
>>
>> (defun inc-all (&optional beg end)
>>   (interactive (when (use-region-p)
>>                  (list (region-beginning) (region-end)) ))
>>   (let ((bg (or beg (point-min)))
>>         (ed (or end (point-max))) )
>>     (save-mark-and-excursion
>>       (goto-char bg)
>>       (while (re-search-forward "[[:digit:]]\\{2\\}" ed t)
>>         (replace-match
>>          (format "%d" (1+ (string-to-number (match-string 0)))) )))))
>
> Ah no, not really; you are parsing region, that is not what I wanted
> there. There is org api to do this.

This doesn't require Org ...

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: Emacs: adding 1 to every number made of 2 digits inside a marked region.
  2021-09-28  1:34         ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2021-09-28  1:51           ` Arthur Miller
  0 siblings, 0 replies; 54+ messages in thread
From: Arthur Miller @ 2021-09-28  1:51 UTC (permalink / raw)
  To: help-gnu-emacs

Emanuel Berg via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org> writes:

> Arthur Miller wrote:
>
>> Emanuel Berg via Users list for the GNU Emacs text editor
>> <help-gnu-emacs@gnu.org> writes:
>>
>>> Arthur Miller wrote:
>>>
>>>> | some    | 34 |  |
>>>> | word    | 30 |  |
>>>> | another | 38 |  |
>>>> | thing   | 59 |  |
>>>> | to      | 39 |  |
>>>> | say     | 10 |  |
>>>> | here    | 47 |  |
>>>
>>> Her you go:
>>>
>>> (defun inc-all (&optional beg end)
>>>   (interactive (when (use-region-p)
>>>                  (list (region-beginning) (region-end)) ))
>>>   (let ((bg (or beg (point-min)))
>>>         (ed (or end (point-max))) )
>>>     (save-mark-and-excursion
>>>       (goto-char bg)
>>>       (while (re-search-forward "[[:digit:]]\\{2\\}" ed t)
>>>         (replace-match
>>>          (format "%d" (1+ (string-to-number (match-string 0)))) )))))
>>
>> Ah no, not really; you are parsing region, that is not what I wanted
>> there. There is org api to do this.
>
> This doesn't require Org ...
I know. But it is trivial with org, which is included in Emacs anyway.

| some    | 34 |  |
| word    | 30 |  |
| another | 38 |  |
| thing   | 59 |  |
| to      | 39 |  |
| say     | 10 |  |
| here    | 47 |  |
#+TBLFM: $3='(1+ '$2);N

Michael showed with calc. I was jsut showing different way, but goofed a bit.



^ permalink raw reply	[flat|nested] 54+ messages in thread

end of thread, other threads:[~2021-09-28  1:51 UTC | newest]

Thread overview: 54+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-22 14:28 Emacs: adding 1 to every number made of 2 digits inside a marked region Hongyi Zhao
2021-09-22 19:50 ` Stephen Berman
2021-09-22 21:04   ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-09-23  0:23   ` Hongyi Zhao
2021-09-23  7:24     ` Stephen Berman
2021-09-23  7:54       ` Hongyi Zhao
2021-09-23  8:07         ` Stephen Berman
2021-09-23  9:00           ` Hongyi Zhao
2021-09-23 10:07             ` Stephen Berman
2021-09-23 10:13               ` Hongyi Zhao
2021-09-23 10:23                 ` Stephen Berman
2021-09-23 12:58                   ` Hongyi Zhao
2021-09-23 13:29                     ` Stephen Berman
2021-09-23 14:25                       ` Hongyi Zhao
2021-09-22 20:38 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-09-23  0:42   ` Hongyi Zhao
2021-09-23  0:46     ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-09-23  0:56       ` Hongyi Zhao
2021-09-23  2:06         ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-09-23  2:12           ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-09-23  0:57     ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-09-23  8:02   ` Hongyi Zhao
2021-09-23  8:37 ` Andreas Röhler
2021-09-23  9:05   ` Hongyi Zhao
2021-09-23  9:58   ` Hongyi Zhao
2021-09-23 10:10     ` Gregory Heytings
2021-09-23 10:17       ` Hongyi Zhao
2021-09-23 13:08         ` Gregory Heytings
2021-09-23 11:59     ` Andreas Röhler
2021-09-23 13:14       ` Hongyi Zhao
2021-09-23 13:51         ` Andreas Röhler
2021-09-23 14:23           ` Hongyi Zhao
2021-09-23  9:26 ` Gregory Heytings
2021-09-23  9:53   ` Hongyi Zhao
2021-09-23 10:02     ` Gregory Heytings
2021-09-23 14:13     ` [External] : " Drew Adams
2021-09-23 23:50       ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-09-24  0:23         ` Drew Adams
2021-09-24  2:34           ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-09-24  3:01             ` Drew Adams
2021-09-24  7:25         ` Gregory Heytings
2021-09-24  7:32           ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-09-23 11:50 ` Andreas Röhler
2021-09-26 22:54 ` Michael Heerdegen
2021-09-26 23:50   ` Arthur Miller
2021-09-27  1:02   ` Arthur Miller
2021-09-27  1:22     ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-09-27  5:57       ` Hongyi Zhao
2021-09-28  1:32         ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-09-27 10:59       ` Arthur Miller
2021-09-28  1:34         ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-09-28  1:51           ` Arthur Miller
2021-09-27  1:03   ` Arthur Miller
2021-09-27 14:08     ` Arthur Miller

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.