unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* general perform-replace REPLACEMENTS arg for regexp query-replacement?
@ 2008-11-15 18:43 Drew Adams
  2008-11-15 22:31 ` general perform-replace REPLACEMENTS arg for regexpquery-replacement? Drew Adams
  0 siblings, 1 reply; 8+ messages in thread
From: Drew Adams @ 2008-11-15 18:43 UTC (permalink / raw)
  To: emacs-devel

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".]





^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-11-18 23:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-15 18:43 general perform-replace REPLACEMENTS arg for regexp query-replacement? Drew Adams
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

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).