Smart Quotes: How to Get Them and How to Get Rid of Them
How to get them in orgmode (via export)
#+OPTIONS: ':t
Or permanently:
(setq org-export-with-smart-quotes t)
How to get rid of them: solutions
https://superuser.com/questions/603421/how-to-remove-smart-quotes-in-copy-paste
https://www.emacswiki.org/emacs/ReplaceGarbageChars
(defun replace-smart-quotes (beg end) "Replace 'smart quotes' in buffer or region with ascii quotes. Operates on the entire buffer if no region is selected." (interactive (if (use-region-p) (list (region-beginning) (region-end)) (list (point-min) (point-max)))) (format-replace-strings '(("\x201C" . "\"") ("\x201D" . "\"") ("\x2018" . "'") ("\x2019" . "'")) nil beg end)) (global-set-key (kbd "C-c q") 'replace-smart-quotes) (defun yank-and-replace-smart-quotes () "Yank (paste) and replace smart quotes from the source with ascii quotes." (interactive) (yank) (replace-smart-quotes (mark) (point))) (global-set-key (kbd "C-c y") 'yank-and-replace-smart-quotes) ;; Replaces various special or "garbage" characters, such as those commonly found in text copied from Microsoft Word documents, with Latin1 equivalents or other specified replacements within the entire buffer. ;; Smart quotes (“ ”) with standard quotes ("). ;; Apostrophes (’) with standard apostrophes ('). ;; Em dashes (—) with double hyphens (--). ;; Ellipses (…) with three periods (...). (defun replace-garbage-chars () "Replace goofy MS and other garbage characters with latin1 equivalents." (interactive) (save-excursion ;save the current point (replace-string "΄" "\"" nil (point-min) (point-max)) (replace-string "“" "\"" nil (point-min) (point-max)) (replace-string "”" "\"" nil (point-min) (point-max)) (replace-string "’" "'" nil (point-min) (point-max)) (replace-string "“" "\"" nil (point-min) (point-max)) (replace-string "—" "--" nil (point-min) (point-max)) ; multi-byte (replace-string "" "'" nil (point-min) (point-max)) (replace-string "" "'" nil (point-min) (point-max)) (replace-string "" "\"" nil (point-min) (point-max)) (replace-string "" "\"" nil (point-min) (point-max)) (replace-string "" "\"" nil (point-min) (point-max)) (replace-string "" "\"" nil (point-min) (point-max)) (replace-string "‘" "\"" nil (point-min) (point-max)) (replace-string "’" "'" nil (point-min) (point-max)) (replace-string "¡\"" "\"" nil (point-min) (point-max)) (replace-string "¡" "..." nil (point-min) (point-max)) (replace-string " " "..." nil (point-min) (point-max)) (replace-string "" " " nil (point-min) (point-max)) ; M-SPC (replace-string "" "`" nil (point-min) (point-max)) ; \221 (replace-string "" "'" nil (point-min) (point-max)) ; \222 (replace-string "" "``" nil (point-min) (point-max)) (replace-string "" "''" nil (point-min) (point-max)) (replace-string "" "*" nil (point-min) (point-max)) (replace-string "" "--" nil (point-min) (point-max)) (replace-string "" "--" nil (point-min) (point-max)) (replace-string " " " " nil (point-min) (point-max)) ; M-SPC (replace-string "¡" "\"" nil (point-min) (point-max)) (replace-string "´" "\"" nil (point-min) (point-max)) (replace-string "»" "<<" nil (point-min) (point-max)) (replace-string "Ç" "'" nil (point-min) (point-max)) (replace-string "È" "\"" nil (point-min) (point-max)) (replace-string "é" "e" nil (point-min) (point-max)) ;; é (replace-string "ó" "-" nil (point-min) (point-max)) )) (replace-string "\221" "`" nil (point-min) (point-max)) ; opening single quote (replace-string "\222" "'" nil (point-min) (point-max)) ; closing single quote (global-set-key (kbd "C-c g") 'replace-garbage-chars)