[Top][All Lists]
[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".]
- general perform-replace REPLACEMENTS arg for regexp query-replacement?,
Drew Adams <=
- RE: general perform-replace REPLACEMENTS arg for regexpquery-replacement?, Drew Adams, 2008/11/15
- Re: general perform-replace REPLACEMENTS arg for regexpquery-replacement?, Juri Linkov, 2008/11/16
- RE: general perform-replace REPLACEMENTS arg for regexpquery-replacement?, Drew Adams, 2008/11/16
- Re: general perform-replace REPLACEMENTS arg for regexpquery-replacement?, Juri Linkov, 2008/11/17
- RE: general perform-replace REPLACEMENTS arg for regexpquery-replacement?, Drew Adams, 2008/11/17
- Re: general perform-replace REPLACEMENTS arg for regexpquery-replacement?, Juri Linkov, 2008/11/18
- RE: general perform-replace REPLACEMENTS arg for regexpquery-replacement?, Drew Adams, 2008/11/18