all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: <emacs-devel@gnu.org>
Subject: general perform-replace REPLACEMENTS arg for regexp query-replacement?
Date: Sat, 15 Nov 2008 10:43:18 -0800	[thread overview]
Message-ID: <005901c94752$06ca6e70$0200a8c0@us.oracle.com> (raw)

See 2008-08-16, thread "Then how to replace all my $$... $$ to \[ \] ..." in
help-gnu-emacs. The subject line says it all. The answer, provided by Reiner
Steib, was to do this:

 M-: (replace-string "$$" '("\\\[" "\\\]"))

or this:

 M-: (replace-regexp "\\$\\$" '("\\\[" "\\\]"))

This works too, and is quite handy:

 M-: (query-replace-regexp "\\$\\$" '("\\\\[" "\\\\]"))

But AFAICT, you cannot use `query-replace-regexp' interactively to do this. You
cannot, for instance, do this to get the same effect:

 C-M-% RET \$\$ RET \, '("\\\\[" "\\\\]")

That just replaces "$$" by the string "(\\[ \\])". 

Reiner also said:

 "However, IMHO this neat feature should be available
  interactively (maybe it is?) and the documentation should
  not be hidden in (info "(elisp)Search and Replace") under
  the internal function `perform-replace'."

I agree with Reiner's suggestions: please make this available to
query-replacement, and please document it more prominently, even if you don't
make it available interactively. Users should be made aware of this feature,
preferably in the Emacs manual's discussion of text replacement.

[See also my mail of today, subject "Emacs manual nodes about text
replacement".]





             reply	other threads:[~2008-11-15 18:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-15 18:43 Drew Adams [this message]
2008-11-15 22:31 ` general perform-replace REPLACEMENTS arg for regexpquery-replacement? Drew Adams
2008-11-16 22:34   ` Juri Linkov
2008-11-17  1:25     ` Drew Adams
2008-11-17 22:51       ` Juri Linkov
2008-11-18  1:01         ` Drew Adams
2008-11-18 22:18           ` Juri Linkov
2008-11-18 23:20             ` Drew Adams

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='005901c94752$06ca6e70$0200a8c0@us.oracle.com' \
    --to=drew.adams@oracle.com \
    --cc=emacs-devel@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.