From 2e488c508f9c10bc17f3176925d4e85b0a79d836 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sat, 2 Apr 2022 13:54:19 -0500 Subject: [PATCH] Add +org-unsmartify --- lisp/+org.el | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lisp/+org.el b/lisp/+org.el index 3d14c52..2a57fe2 100644 --- a/lisp/+org.el +++ b/lisp/+org.el @@ -568,5 +568,19 @@ and POST-PROCESS are passed to `org-export-to-file'." (interactive) (+org-export-clip-to-html nil :subtree)) +;;; Unsmartify quotes and dashes and stuff. +(defun +org-unsmartify () + "Replace \"smart\" punctuation with their \"dumb\" counterparts." + (interactive) + (save-excursion + (goto-char (point-min)) + (while (re-search-forward "[“”‘’–—]" nil t) + (let ((replace (pcase (match-string 0) + ((or "“" "”") "\"") + ((or "‘" "’") "'") + ("–" "--") + ("—" "---")))) + (replace-match replace nil nil))))) + (provide '+org) ;;; +org.el ends here