Skip to content

Instantly share code, notes, and snippets.

@psachin
Last active August 29, 2015 14:01
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 psachin/a9cdd03437b3d0c8b9fe to your computer and use it in GitHub Desktop.
Save psachin/a9cdd03437b3d0c8b9fe to your computer and use it in GitHub Desktop.
Wrap word or region inside user specified input. like <>," ",' ',[ ], etc.
(defun surround(tag)
"Surround content within html TAG.
TAG can be <>," ",' ',[ ], etc."
(interactive "sWord should be inside: ")
(backward-word)
(mark-word)
(when (region-active-p)
(kill-region (region-beginning) (region-end)))
(insert tag)
(backward-char)
(yank))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment