]> gitweb.michael.orlitzky.com - emacs.d.git/blob - fix-nonstandard-chars.el
Overhauled the fix-nonstandard-chars function because it was completely broken.
[emacs.d.git] / fix-nonstandard-chars.el
1 (defun fix-nonstandard-chars (context)
2 "Replace some typical nonstandard characters that result from
3 copy-and-pasting word processor text into XHTML documents."
4
5 (interactive "p")
6
7 (setq replacements '( ("’" "'")
8 ("“" "“")
9 ("”" "”")
10 ("–" "-")
11 ("—" "—") ))
12
13 (dolist (replacement replacements nil)
14 ;; The mark gets all fucked up here. It's easiest to
15 ;; just return to the beginning of the buffer each time.
16 (beginning-of-buffer)
17 (replace-string (nth 0 replacement) (nth 1 replacement))
18 )
19 )