emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/ruby-end 9801aa199a 09/91: Do not expand when there's t


From: ELPA Syncer
Subject: [elpa] externals/ruby-end 9801aa199a 09/91: Do not expand when there's text after point.
Date: Wed, 25 Jan 2023 19:58:24 -0500 (EST)

branch: externals/ruby-end
commit 9801aa199a97a864c1674cdb6e702144cc405ac8
Author: Johan Andersson <johan.rejeep@gmail.com>
Commit: Johan Andersson <johan.rejeep@gmail.com>

    Do not expand when there's text after point.
---
 features/ruby-end.feature                   | 16 ++++++++++++++++
 features/step-definitions/ruby-end-steps.el |  4 ++++
 ruby-end.el                                 |  3 ++-
 3 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/features/ruby-end.feature b/features/ruby-end.feature
index 11b73f0d84..7625203a91 100644
--- a/features/ruby-end.feature
+++ b/features/ruby-end.feature
@@ -42,6 +42,22 @@ Feature: Insert end
       xif condition
       """
 
+  Scenario: Text after keyword
+    When I type "condition"
+    And I go to the beginning of the line
+    And I type "if"
+    And I press "SPC"
+    Then I should see:
+      """
+      if condition
+      """
+    But I should not see:
+      """
+      if
+
+      endcondition
+      """
+
   Scenario: Other character before keyword
     When I type "!"
     And I type "if"
diff --git a/features/step-definitions/ruby-end-steps.el 
b/features/step-definitions/ruby-end-steps.el
index c0efdcf66e..b73e9d9c7d 100644
--- a/features/step-definitions/ruby-end-steps.el
+++ b/features/step-definitions/ruby-end-steps.el
@@ -29,3 +29,7 @@
 (Given "^I set face to be string$"
        (lambda ()
          (add-text-properties (point-min) (point-max) '(face 
font-lock-comment-face))))
+
+(When "^I go to the beginning of the line$"
+      (lambda ()
+        (call-interactively 'beginning-of-line)))
diff --git a/ruby-end.el b/ruby-end.el
index 08ea7c5ebf..0ee4176771 100644
--- a/ruby-end.el
+++ b/ruby-end.el
@@ -77,7 +77,8 @@
   "Checks if expansion (insertion of end) should be done."
   (and
    (ruby-end-code-at-point-p)
-   (looking-back ruby-end-keywords-re)))
+   (looking-back ruby-end-keywords-re)
+   (looking-at "\\s-*$")))
 
 (defun ruby-end-code-at-point-p ()
   "Checks if point is code, or comment or string."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]