From 5aaa962389a28754adfb00b677f2fc4b6ee972cd Mon Sep 17 00:00:00 2001 From: Kyle Isom Date: Wed, 14 May 2025 19:15:47 -0700 Subject: [PATCH] adding function to normalize text --- init.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/init.el b/init.el index a00b70b..082c239 100644 --- a/init.el +++ b/init.el @@ -113,6 +113,18 @@ present on disk." ;; i like refilling paragraphs (global-set-key (kbd "M-q") 'fill-paragraph) +(defun normalize-text () (interactive) + (save-excursion + (let ((normalizer (lambda (from to) + (beginning-of-buffer) + (while (search-forward from nil t) + (replace-match to nil t)))) + (replacements '(("’" . "'") + ("”" . "\"") + ("“" . "\"")))) + (dolist (replacement replacements) + (funcall normalizer (car replacement) (cdr replacement)))))) + ;;; add some of the local install paths to the exec path if they ;;; exist. (require 'exec-path-from-shell)