You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.6 KiB
EmacsLisp

(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))
2 years ago
(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)
2 years ago
(replace-match ""))
(goto-char (point-min))
2 years ago
(while (re-search-forward "“/" nil t)
(replace-match "/“"))
(goto-char (point-min))
2 years ago
(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\"")))