]> gitweb.michael.orlitzky.com - emacs.d.git/blobdiff - fix-nonstandard-chars.el
mode-hooks/python-mode-hooks.el: don't mangle docstrings please.
[emacs.d.git] / fix-nonstandard-chars.el
index 52f42df6c2b8d565eb80d191604ef8932648bc2b..e1ec2f563d8ddc7cd796c411c40a4f8dee56d7b3 100644 (file)
@@ -2,11 +2,24 @@
   "Replace some typical nonstandard characters that result from
    copy-and-pasting word processor text into XHTML documents."
 
-  (interactive "P")
+  (interactive "p")
 
-  (replace-string "’" "'")
-  (replace-string "“" "“")
-  (replace-string "”" "”")
-  (replace-string "–" "-")
-  (replace-string "—" "—")
+  (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))
+    )
 )