From 0c409a1938b19480d279bf9ffded2eaaf84caabc Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 28 May 2016 11:40:58 +0000 Subject: 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 --- ChangeLog | 5 +++++ misc/ruby-additional.el | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/ChangeLog b/ChangeLog index afca264bb9..1fc2cc0ae6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sat May 28 20:40:57 2016 Nobuyoshi Nakada + + * 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 * 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. -- cgit v1.2.3