(defun fix-nonstandard-chars (context) "Replace some typical nonstandard characters that result from copy-and-pasting word processor text into XHTML documents." (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)) ) )