all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Barry Margolin <barmar@alum.mit.edu>
To: help-gnu-emacs@gnu.org
Subject: Re: Advanced query-replace-regexp in code
Date: Thu, 28 May 2009 22:14:02 -0400	[thread overview]
Message-ID: <barmar-32763A.22140228052009@mara100-84.onlink.net> (raw)
In-Reply-To: mailman.8013.1243539406.31690.help-gnu-emacs@gnu.org

In article <mailman.8013.1243539406.31690.help-gnu-emacs@gnu.org>,
 bojohan+news@dd.chalmers.se (Johan Bockgard) wrote:

> Barry Margolin <barmar@alum.mit.edu> writes:
> 
> > 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?
> 
> They shouldn't call it:
> 
>     This function is usually the wrong thing to use in a Lisp program.
>     What you probably want is a loop like this:
>       (while (re-search-forward REGEXP nil t)
>         (replace-match TO-STRING nil nil))
>     which will run faster and will not set the mark or print anything.

Regardless of whether they should or shouldn't use it, it still seems 
strange that the function interprets the second argument differently 
depending on whether it's use interactively or programmatically.  If it 
shouldn't be used programmatically, why is it important that this mode 
*not* recognize \,<expr>?

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


  parent reply	other threads:[~2009-05-29  2:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-27 14:03 Advanced query-replace-regexp in code Nordlöw
2009-05-27 14:32 ` Pascal J. Bourguignon
2009-05-28  1:19 ` Barry Margolin
2009-05-28  4:57   ` Teemu Likonen
2009-05-28  7:04     ` Barry Margolin
2009-05-28 19:36       ` Johan Bockgård
     [not found]       ` <mailman.8013.1243539406.31690.help-gnu-emacs@gnu.org>
2009-05-29  2:14         ` Barry Margolin [this message]
2009-05-30  6:34           ` Nordlöw
2009-05-30 18:55           ` Johan Bockgård
     [not found]           ` <mailman.8166.1243709727.31690.help-gnu-emacs@gnu.org>
2009-05-31  1:57             ` Barry Margolin
2009-05-28 19:50 ` harven
2009-08-02 16:19 ` David Kastrup
2009-08-02 17:14   ` Thierry Volpiatto
2009-08-02 20:25     ` Thierry Volpiatto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=barmar-32763A.22140228052009@mara100-84.onlink.net \
    --to=barmar@alum.mit.edu \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.