This is related to Emacs: regular expression replacing to change case
My additional problem is that I need to script the search-replace but the "\,()"
solution works (for me) only when used interactively (emacs 24.2.1)
. Inside a script it gives the error: "Invalid use of \'
in replacement text".
I usually write a "perform-replace" to some file to be loaded when needed. Something like:
(perform-replace "<\\([^>]+\\)>" "<\\,(downcase \1)>"
t t nil 1 nil (point-min) (point-max))
It should be possible to call a function to generate the replacement (pg 741 of the emacs lisp manual)
, but I've tried many variations of the following with no luck:
(defun myfun ()
(downcase (match-string 0)))
(perform-replace "..." (myfun . ()) t t nil)
Can anyone help?