ruby-changes:43123
From: nobu <ko1@a...>
Date: Sat, 28 May 2016 20:41:03 +0900 (JST)
Subject: [ruby-changes:43123] nobu:r55197 (trunk): ruby-insert-heredoc-code-block
nobu 2016-05-28 20:40:58 +0900 (Sat, 28 May 2016) New Revision: 55197 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55197 Log: ruby-insert-heredoc-code-block * misc/ruby-additional.el (ruby-insert-heredoc-code-block): insert here document code block for assert_separately mainly. Modified files: trunk/ChangeLog trunk/misc/ruby-additional.el Index: misc/ruby-additional.el =================================================================== --- misc/ruby-additional.el (revision 55196) +++ misc/ruby-additional.el (revision 55197) @@ -157,6 +157,18 @@ Emacs to Ruby." https://github.com/ruby/ruby/blob/trunk/misc/ruby-additional.el#L157 "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. Index: ChangeLog =================================================================== --- ChangeLog (revision 55196) +++ ChangeLog (revision 55197) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sat May 28 20:40:57 2016 Nobuyoshi Nakada <nobu@r...> + + * 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@i...> * test/test_unicode_normalize.rb: Add test to check for availability of -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/