emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

general perform-replace REPLACEMENTS arg for regexp query-replacement?


From: Drew Adams
Subject: general perform-replace REPLACEMENTS arg for regexp query-replacement?
Date: Sat, 15 Nov 2008 10:43:18 -0800

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 via email to

[Prev in Thread] Current Thread [Next in Thread]