From 4db88b40d59182e654e24cdd64cd6e163096183b Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Tue, 2 Feb 2010 16:19:26 -0500 Subject: [PATCH] Overhauled the fix-nonstandard-chars function because it was completely broken. --- fix-nonstandard-chars.el | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/fix-nonstandard-chars.el b/fix-nonstandard-chars.el index 52f42df..2ba368b 100644 --- a/fix-nonstandard-chars.el +++ b/fix-nonstandard-chars.el @@ -2,11 +2,18 @@ "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)) + ) ) -- 2.43.2