Created
May 14, 2014 18:40
-
-
Save AeroNotix/ff3ad7d142896695bba8 to your computer and use it in GitHub Desktop.
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 trim-string (string) | |
(replace-regexp-in-string | |
"\\`[ \t\n]*" "" | |
(replace-regexp-in-string "[ \t\n]*\\'" "" string))) | |
(defun move-to-export () | |
(search-backward "-export")) | |
(defun go-to-export-end () | |
(search-forward "]).")) | |
(defun split-erlang-exports () | |
(interactive) | |
(save-excursion | |
(if (not (looking-at "-export")) | |
(move-to-export)) | |
(forward-char (length "-export([")) | |
(push-mark) | |
(if (not (looking-at "])")) | |
(progn | |
(go-to-export-end) | |
(backward-char 3))) | |
(let* ((selection | |
(buffer-substring-no-properties (region-beginning) (region-end))) | |
(exports (split-string selection ","))) | |
(move-to-export) | |
(push-mark) | |
(go-to-export-end) | |
(kill-region (region-beginning) (region-end)) | |
(dolist (e exports) | |
(let ((s (format "-export([%s]).\n" (trim-string e)))) | |
(insert s)))))) |
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
-export([start_vnode/1, | |
init/1, | |
terminate/2, | |
handle_command/3, | |
is_empty/1, | |
delete/1, | |
handle_handoff_command/3, | |
handoff_starting/2, | |
handoff_cancelled/1, | |
handoff_finished/2, | |
handle_handoff_data/2, | |
encode_handoff_item/2, | |
handle_coverage/4, | |
handle_exit/3]). | |
%% TO => | |
-export([start_vnode/1]). | |
-export([init/1]). | |
-export([terminate/2]). | |
-export([handle_command/3]). | |
-export([is_empty/1]). | |
-export([delete/1]). | |
-export([handle_handoff_command/3]). | |
-export([handoff_starting/2]). | |
-export([handoff_cancelled/1]). | |
-export([handoff_finished/2]). | |
-export([handle_handoff_data/2]). | |
-export([encode_handoff_item/2]). | |
-export([handle_coverage/4]). | |
-export([handle_exit/3]). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment