doomemacs/init/my-defuns.el
2015-05-08 03:03:38 -04:00

27 lines
777 B
EmacsLisp
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

;;;; HTML ;;;;
;; Replace smart quotes and other MS Word verbiage into plain text
(defun replace:plain-textify (beg end)
(interactive "r")
(replace-regexp "" "..." nil beg end)
(replace-regexp "[]" "'" nil beg end)
(replace-regexp "[“”]" "\"" nil beg end))
;; Email address with mailto link
(defun replace:email2mailto (beg end)
(interactive "r")
(replace-regexp "\\b\\([a-zA-Z0-9._+-%]+@[a-zA-Z0-9-.]+\\.[a-zA-Z]+\\)\\b"
"<a href=\"mailto:\\1\">\\1</a>"
nil beg end))
;; Link with anchor
(defun replace:url2anchor (beg end)
(interactive "r")
(replace-regexp "\\bhttps?://.+?\\b"
"<a href=\"\\1\">\\1</a>"
nil beg end))
(provide 'my-defuns)
;;; my-defuns.el ends here