[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How modify numbers in a region by a multiplier?
From: |
David Kastrup |
Subject: |
Re: How modify numbers in a region by a multiplier? |
Date: |
Wed, 08 Dec 2010 15:16:57 -0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
Seweryn Kokot <sewkokot@gmail.com> writes:
> Juanma Barranquero <lekktu <at> gmail.com> writes:
>
>> Qiang Guo is right, though, in pointing that you're using a fixed
>> `end' but the buffer or region length is potentially changing with
>> every replace.
>
> Is there a canonical solution to this problem, since it seems that it should
> happen frequently when using the following structure:
> (while (re-search-forward "\\([0-9.]+\\)" end t)
> (replace-match (format "%.2f" (* (string-to-number (match-string 1))
> multiplier))))
Probably easiest to do
(save-restriction
(narrow-to-region start end
...
--
David Kastrup
- Re: How modify numbers in a region by a multiplier?, David Kastrup, 2010/12/08
- Re: How modify numbers in a region by a multiplier?, Marc Mientki, 2010/12/08
- Re: How modify numbers in a region by a multiplier?, Andreas Politz, 2010/12/08
- Re: How modify numbers in a region by a multiplier?, Pascal J. Bourguignon, 2010/12/08
- Re: How modify numbers in a region by a multiplier?,
David Kastrup <=
- Re: How modify numbers in a region by a multiplier?, Andreas Politz, 2010/12/08
- Re: How modify numbers in a region by a multiplier?, David Kastrup, 2010/12/08
- Re: How modify numbers in a region by a multiplier?, David Kastrup, 2010/12/08