Last active
January 1, 2016 00:39
-
-
Save ShingoFukuyama/8067617 to your computer and use it in GitHub Desktop.
emacs mykie.el[https://github.com/yuutayamada/mykie-el] sample1 Wrap regioned area with parentheses, brackets, quote or whatever.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require 'mykie) | |
(defun my-wrap-region (&optional $open $close) | |
(interactive) | |
(when mark-active | |
(let (($beg (region-beginning)) | |
($end (region-end))) | |
(deactivate-mark) | |
(goto-char $end) | |
(insert $close) | |
(goto-char $beg) | |
(insert $open)))) | |
(mykie:set-keys 'with-self-key | |
"(" :region&C-u '(my-wrap-region "(" ")") | |
"[" :region&C-u '(my-wrap-region "[" "]") | |
"{" :region&C-u '(my-wrap-region "{" "}") | |
"<" :region&C-u '(my-wrap-region "<" ">") | |
"'" :region&C-u '(my-wrap-region "'" "'") | |
"\"" :region&C-u '(my-wrap-region "\"" "\"")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment