Skip to content

Instantly share code, notes, and snippets.

@jiyoo
Last active December 19, 2015 03:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jiyoo/5892224 to your computer and use it in GitHub Desktop.
Save jiyoo/5892224 to your computer and use it in GitHub Desktop.
instruction for what to do with a code you copied from a blog comment
;; copy the following and
;; paste it in your emacs init file (the dotemacs file)
(defun fix-quotes (beg end)
"replaces pretty quotes to ugly quotes."
(interactive "r")
(save-excursion
(format-replace-strings '(("\x2019" . "'")
("\x201c" . "\"")
("\x201d" . "\"")
("\x2018" . "'")
) nil beg end))
(indent-region (region-beginning) (region-end)))
;; then restart your emacs.
;; now you can copy an emacs lisp code example from a blog comment and
;; paste it in your scratch buffer and
;; then select the pasted region (this step usually not necessary)
;; and then do M-x fix-quotes and quotes will be fixed
;; and the pasted code will be indented.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment