diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-05-28 11:40:58 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-05-28 11:40:58 +0000 |
commit | a552fa2d66d495ec9700e9a656137e444b6f24dd (patch) | |
tree | d6f692dd1b4ee2450f7c41447ff3a3b416252a53 | |
parent | 3883bb6baeabd8c60e9c01c43714cef3a99fa87a (diff) | |
download | ruby-a552fa2d66d495ec9700e9a656137e444b6f24dd.tar.gz |
ruby-insert-heredoc-code-block
* misc/ruby-additional.el (ruby-insert-heredoc-code-block): insert
here document code block for assert_separately mainly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | misc/ruby-additional.el | 12 |
2 files changed, 17 insertions, 0 deletions
@@ -1,3 +1,8 @@ +Sat May 28 20:40:57 2016 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * misc/ruby-additional.el (ruby-insert-heredoc-code-block): insert + here document code block for assert_separately mainly. + Sat May 28 20:34:19 2016 Martin Duerst <duerst@it.aoyama.ac.jp> * test/test_unicode_normalize.rb: Add test to check for availability of diff --git a/misc/ruby-additional.el b/misc/ruby-additional.el index 198510979e..5beecac219 100644 --- a/misc/ruby-additional.el +++ b/misc/ruby-additional.el @@ -157,6 +157,18 @@ Emacs to Ruby." "Convert Unicode <-> \\u{} in the given region." (interactive "P\nr") (if dec (ruby-decode-unicode beg end) (ruby-encode-unicode beg end))) + + (defun ruby-insert-heredoc-code-block (arg) + "Insert indented here document code block" + (interactive "P") + (let ((c (if arg "~" "-"))) + (insert "\"#{<<" c "begin}#{<<" c "\"end;\"}\"")) + (end-of-line) + (if (eobp) (insert "\n") (forward-char)) + (indent-region (point) + (progn (insert "begin\n" "end;\n") (point))) + (beginning-of-line 0)) + (define-key ruby-mode-map "\C-cH" 'ruby-insert-heredoc-code-block) )) ;; monkey-patching ruby-mode.el in Emacs 24, as r49872. |