I am writing a function to do replacements on a highlighted region. It appears that while region-end
changes after each replace, the value is not correct. That is, it does not point to the last character of the initial highlighted region. I am using CUA. Here is a shortened version of my
function.
(defun sql-cln ()
(interactive)
(progn
(replace-string "\"" "" nil (region-beginning) (region-end))
(replace-string "\t" "" nil (region-beginning) (region-end))
(replace-string "\n" "" nil (region-beginning) (region-end))
(replace-regexp " +" " " nil (region-beginning) (region-end))
))
Here's the text I test it on.
select x.group_id, g.loc_prefix"
" from station_group_xref x, station_group g"
" where x.station_id = $1"
" and g.loc_grp = 1"
" and x.group_id = g.group_id