Running Spacemacs v.0.200.13 on emacs 25.2.2 on Kubuntu 18.04.
Consider the following code:
(defun xx-ll ()
(interactive)
(save-excursion
(goto-char (point-min))
(xx-replace-regexp-and-return
"^[[:blank:]]\*LLA[[:space:]]\*\\(<[ou]l class=\"nicelist\"\\)"
"\\1 type=\"A\"")
(xx-replace-regexp-and-return
"^[[:blank:]]\*LLI[[:space:]]\*\\(<[ou]l class=\"nicelist\"\\)"
"\\1 type=\"I\"")
(xx-replace-regexp-and-return
"^[[:blank:]]\*LLa[[:space:]]\*\\(<[ou]l class=\"nicelist\"\\)"
"\\1 type=\"a\"")
(xx-replace-regexp-and-return
"^[[:blank:]]\*LLi[[:space:]]\*\\(<[ou]l class=\"nicelist\"\\)"
"\\1 type=\"i\"")))
(defun xx-replace-regexp-and-return (from to)
(save-excursion
(while (re-search-forward from nil t)
(replace-match to 1))))
The 1
in replace-to
is to preserve case of replacement string. All goes well except that LLa
and LLi
leads to replacement by type="A"
and type="I"
respectively.
How do I set this right? Also, if I need to make any changes to any initialization variables, I will like to make them ONLY for this function.