Created
February 18, 2015 23:58
-
-
Save jplindstrom/cf4c82bd4f92de6d39f6 to your computer and use it in GitHub Desktop.
Emacs, Perl add deref
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
(defun ps/edit-deref-type (sigil) | |
"Enclose the text from point and backwards to the preceeding $ | |
in SIGIL{TEXT}." | |
(let ((end (point))) | |
(when (search-backward "$" nil t) | |
(insert sigil) | |
(insert "{") | |
(goto-char (+ 2 end)) | |
(insert "}") | |
) | |
)) | |
(defun ps/edit-deref-array () | |
"Enclose the text from point and backwards to the preceeding $ | |
in a @{YOUR-TEXT-HERE}." | |
(interactive) | |
(ps/edit-deref-type "@")) | |
(defun ps/edit-deref-hash () | |
"Enclose the text from point and backwards to the preceeding $ | |
in a %{YOUR-TEXT-HERE}." | |
(interactive) | |
(ps/edit-deref-type "%")) | |
(global-set-key (kbd "C-o e d") 'ps/edit-deref-array) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment