[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Advanced query-replace-regexp in code
From: |
Barry Margolin |
Subject: |
Re: Advanced query-replace-regexp in code |
Date: |
Thu, 28 May 2009 03:04:26 -0400 |
User-agent: |
MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) |
In article <878wkhakp1.fsf@iki.fi>, Teemu Likonen <tlikonen@iki.fi>
wrote:
> On 2009-05-27 21:19 (-0400), Barry Margolin wrote:
>
> > In interactive calls, the replacement text may contain `\,'
> >
> > It's a special extension just for interactive use. I'm not sure why it
> > was restricted this way.
>
> I think in Lisp programs it's much easier and more problem-free to
> evaluate Lisp expressions normal Lisp-way than to write expressions
> inside strings and use the "\\,expression" form there.
>
> Interactive replace string
>
> \,(capitalize \1)
>
> can be written as
>
> (capitalize (match-string 1))
>
> in programs. With functions like "concat" or "format" the latter
> expression can be concatenated with the surrounding replace string.
In that case, why allow programs to call replace-regexp in the first
place? If they can call it, why shouldn't they be able to use all the
features?
replace-regexp also does the searching and looping for you. So instead
of a simple, concise one-liner, you have to code everything, with the
potential to screw up.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
- Advanced query-replace-regexp in code, Nordlöw, 2009/05/27
- Re: Advanced query-replace-regexp in code, Pascal J. Bourguignon, 2009/05/27
- Re: Advanced query-replace-regexp in code, Barry Margolin, 2009/05/27
- Re: Advanced query-replace-regexp in code, Teemu Likonen, 2009/05/28
- Re: Advanced query-replace-regexp in code,
Barry Margolin <=
- Re: Advanced query-replace-regexp in code, Johan Bockgård, 2009/05/28
- Message not available
- Re: Advanced query-replace-regexp in code, Barry Margolin, 2009/05/28
- Re: Advanced query-replace-regexp in code, Nordlöw, 2009/05/30
- Re: Advanced query-replace-regexp in code, Johan Bockgård, 2009/05/30
- Message not available
- Re: Advanced query-replace-regexp in code, Barry Margolin, 2009/05/30
Re: Advanced query-replace-regexp in code, harven, 2009/05/28