adding function to normalize text
This commit is contained in:
parent
e5b4b5991e
commit
5aaa962389
12
init.el
12
init.el
|
@ -113,6 +113,18 @@ present on disk."
|
||||||
;; i like refilling paragraphs
|
;; i like refilling paragraphs
|
||||||
(global-set-key (kbd "M-q") 'fill-paragraph)
|
(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
|
;;; add some of the local install paths to the exec path if they
|
||||||
;;; exist.
|
;;; exist.
|
||||||
(require 'exec-path-from-shell)
|
(require 'exec-path-from-shell)
|
||||||
|
|
Loading…
Reference in New Issue