[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: replace matches in any string
From: |
David Kastrup |
Subject: |
Re: replace matches in any string |
Date: |
Thu, 02 Sep 2010 20:04:39 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
Ted Zlatanov <address@hidden> writes:
> On Thu, 02 Sep 2010 19:22:35 +0200 David Kastrup <address@hidden> wrote:
>
> DK> Ted Zlatanov <address@hidden> writes:
>>> That would be great. Then we wouldn't have to play the string-match
>>> regex escaping game above. But it complicates the code a bit to
>>> provide `string'.
>
> DK> Hardly.
>
> Is "a tiny bit" more accurate? In any case,
> `match-substitute-replacement' seems like the right function. Thank
> you.
>
>>> I think Lars's suggestion to always save `string' to the same global
>>> variable is sensible;
>
> DK> For one thing I guess it is too late to change the API.
>
> There's no change! Saving the string is setting just one pointer
> reference and does not change any existing code or APIs.
A function using save-match-data may be used in any hook or other stuff
called nearly asynchronously. It is a very bad idea to add some global
variable to the match data (which is everything that affects matching)
without making save-match-data, match-data and set-match-data involved.
> DK> For another, that prevents strings from being garbage-collected as
> DK> long as they are present in some match-data. While the same is true
> DK> of buffers, a dead buffer does not take significant space.
>
> Only one string would be kept around, not all the matches (I think
> you're thinking of the tacked-on wishlist item below).
Huh? Of course only one string would be kept around, the source string
on which the match was made. And that is at least as long as all
matches combined (at least when the matches are not inside one another).
--
David Kastrup
- Re: replace matches in any string, Ted Zlatanov, 2010/09/01
- Re: replace matches in any string, Stefan Monnier, 2010/09/02
- Re: replace matches in any string, Ted Zlatanov, 2010/09/02
- Re: replace matches in any string, Lars Magne Ingebrigtsen, 2010/09/02
- Re: replace matches in any string, Stefan Monnier, 2010/09/02
- Re: replace matches in any string, David Kastrup, 2010/09/02
- Re: replace matches in any string, Ted Zlatanov, 2010/09/02
- Re: replace matches in any string, David Kastrup, 2010/09/02
- Re: replace matches in any string, Ted Zlatanov, 2010/09/02
- Re: replace matches in any string,
David Kastrup <=
- Re: replace matches in any string, Ted Zlatanov, 2010/09/02
- Recommended gnus spam filter system?, Camm Maguire, 2010/09/02
- Re: Recommended gnus spam filter system?, Frank Schmitt, 2010/09/02
- Re: Recommended gnus spam filter system?, Karl Fogel, 2010/09/02
- Re: Recommended gnus spam filter system?, Thorsten Bonow, 2010/09/03
- Re: replace matches in any string, Stefan Monnier, 2010/09/02
- Re: replace matches in any string, Lars Magne Ingebrigtsen, 2010/09/02
- Re: replace matches in any string, Davis Herring, 2010/09/02
- Re: replace matches in any string, David Kastrup, 2010/09/03
- Re: replace matches in any string, Lars Magne Ingebrigtsen, 2010/09/03