branch: externals/ruby-end
commit ab84e909b39f4d800c6efcf349429509933b28aa
Author: Dmitry Gutov <[email protected]>
Commit: Dmitry Gutov <[email protected]>
Override ruby-end-insert-newline to t if RET is pressed
---
features/ruby-end.feature | 11 +++++++++++
ruby-end.el | 3 ++-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/features/ruby-end.feature b/features/ruby-end.feature
index 566516b99a..22041cdffe 100644
--- a/features/ruby-end.feature
+++ b/features/ruby-end.feature
@@ -96,6 +96,17 @@ Feature: Insert end
end
"""
+ Scenario: Always insert newline after RET
+ Given insert newline is turned off
+ When I type "foo do"
+ And I press "RET"
+ Then I should see:
+ """
+ foo do
+
+ end
+ """
+
# NOTE:
# I have to hax these two scenarios, since running Emacs in batch
# mode does not set the text properties.
diff --git a/ruby-end.el b/ruby-end.el
index ba969fc223..7425dbc376 100644
--- a/ruby-end.el
+++ b/ruby-end.el
@@ -119,7 +119,8 @@ When nil, any `last-command' will do."
(interactive)
(cond
((and ruby-end-expand-on-ret (ruby-end-expand-p))
- (ruby-end-insert-end)
+ (let ((ruby-end-insert-newline t))
+ (ruby-end-insert-end))
(forward-line 1)
(indent-according-to-mode))
(t