(defun org-format () "Correct formatting in an org file" (interactive) (goto-char (point-min)) (while (re-search-forward " -" nil t) (replace-match " –")) (goto-char (point-min)) (while (re-search-forward " –" nil t) (replace-match " –")) (goto-char (point-min)) (while (re-search-forward "/ –" nil t) (replace-match " –/")) (goto-char (point-min)) (while (re-search-forward " \\.\\.\\." nil t) (replace-match " …")) (goto-char (point-min)) (while (re-search-forward " …" nil t) (replace-match " …")) (goto-char (point-min)) (while (re-search-forward "'" nil t) (replace-match "’")) (goto-char (point-min)) (while (re-search-forward " \n" nil t) (replace-match "\n")) (goto-char (point-min)) (while (re-search-forward "\n\"" nil t) (replace-match "\n“")) (goto-char (point-min)) (while (re-search-forward " \"" nil t) (replace-match " “")) (goto-char (point-min)) (while (re-search-forward "\"" nil t) (replace-match "”")) (goto-char (point-min)) (while (re-search-forward "“/" nil t) (replace-match "/“")) (goto-char (point-min)) (while (re-search-forward "/”" nil t) (replace-match "”/")) (goto-char (point-min)) (while (re-search-forward "=”" nil t) (replace-match "=\"")) (goto-char (point-min)) (while (re-search-forward "”>" nil t) (replace-match "\">")) (goto-char (point-min)) (while (re-search-forward "”/>" nil t) (replace-match "\"/>")) (goto-char (point-min)) (while (re-search-forward "=\"\\([^>]*\\)”" nil t) (replace-match "=\"\\1\"")))