X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=fix-nonstandard-chars.el;h=2ba368b83a81aecceb4d9ab569944567b1ca6300;hb=3e0f999e18c33e21e4d38c4e019e8324b1a19d77;hp=e5c3464476659ea7a98c3757b567fde8603c6a0c;hpb=c8ef0ff3bd4f0b1ddaaadf9770d64db7fe28159a;p=emacs.d.git diff --git a/fix-nonstandard-chars.el b/fix-nonstandard-chars.el index e5c3464..2ba368b 100644 --- a/fix-nonstandard-chars.el +++ b/fix-nonstandard-chars.el @@ -1,9 +1,19 @@ -(defun fix-nonstandard-chars +(defun fix-nonstandard-chars (context) "Replace some typical nonstandard characters that result from copy-and-pasting word processor text into XHTML documents." - (replace-string "’" "'") - (replace-string "“" "“") - (replace-string "”" "”") - (replace-string "–" "-") + (interactive "p") + + (setq replacements '( ("’" "'") + ("“" "“") + ("”" "”") + ("–" "-") + ("—" "—") )) + + (dolist (replacement replacements nil) + ;; The mark gets all fucked up here. It's easiest to + ;; just return to the beginning of the buffer each time. + (beginning-of-buffer) + (replace-string (nth 0 replacement) (nth 1 replacement)) + ) )