[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ruby-end cf55eff3f8 60/91: Merge branch 'last-command'
From: |
ELPA Syncer |
Subject: |
[elpa] externals/ruby-end cf55eff3f8 60/91: Merge branch 'last-command' |
Date: |
Wed, 25 Jan 2023 19:58:28 -0500 (EST) |
branch: externals/ruby-end
commit cf55eff3f8a367f3a74d530988e36194148e9aa0
Merge: 8b2aaf6467 19037b0c8c
Author: Johan Andersson <johan.rejeep@gmail.com>
Commit: Johan Andersson <johan.rejeep@gmail.com>
Merge branch 'last-command'
---
features/ruby-end.feature | 21 +++++++++++++++++++++
features/step-definitions/ruby-end-steps.el | 9 +++++++++
features/support/env.el | 3 ++-
ruby-end.el | 9 +++++++++
4 files changed, 41 insertions(+), 1 deletion(-)
diff --git a/features/ruby-end.feature b/features/ruby-end.feature
index d3919bd2fc..566516b99a 100644
--- a/features/ruby-end.feature
+++ b/features/ruby-end.feature
@@ -180,3 +180,24 @@ Feature: Insert end
Proc.new do
"""
+
+ Scenario: Do not expand when the last command was not insertion
+ Given I restrict expansion to only after insertion
+ When I press "i"
+ And I press "f"
+ And I press "<left>"
+ And I press "<right>"
+ And I press "SPC"
+ Then I should see "if "
+ And end should not be insterted
+
+ Scenario: Expand when the last command was insertion
+ Given I restrict expansion to only after insertion
+ When I type "if" interactively
+ And I press "SPC"
+ Then I should see:
+ """
+ if
+
+ end
+ """
diff --git a/features/step-definitions/ruby-end-steps.el
b/features/step-definitions/ruby-end-steps.el
index ae9ab7fdc8..3349d7d901 100644
--- a/features/step-definitions/ruby-end-steps.el
+++ b/features/step-definitions/ruby-end-steps.el
@@ -45,3 +45,12 @@
(Given "I disable expand on return"
(lambda ()
(setq ruby-end-expand-on-ret nil)))
+
+(Given "^I type \"\\([^\"]+\\)\" interactively"
+ (lambda (str)
+ (When "I type \"%s\"" str)
+ (setq this-command 'self-insert-command)))
+
+(Given "I restrict expansion to only after insertion"
+ (lambda ()
+ (setq ruby-end-expand-only-for-last-commands '(self-insert-command))))
diff --git a/features/support/env.el b/features/support/env.el
index 636e6eff37..0cedd2a14b 100644
--- a/features/support/env.el
+++ b/features/support/env.el
@@ -10,7 +10,8 @@
(Before
(setq ruby-end-insert-newline t)
- (setq ruby-end-expand-on-ret t))
+ (setq ruby-end-expand-on-ret t)
+ (setq ruby-end-expand-only-for-last-commands nil))
(require 'ruby-end)
(require 'espuds)
diff --git a/ruby-end.el b/ruby-end.el
index c9310e8c45..d453b60405 100644
--- a/ruby-end.el
+++ b/ruby-end.el
@@ -76,6 +76,13 @@
:type 'boolean
:group 'ruby)
+(defcustom ruby-end-expand-only-for-last-commands '(self-insert-command)
+ "List of `last-command' values to restrict expansion to, or nil.
+
+When nil, any `last-command' will do."
+ :type '(repeat function)
+ :group 'ruby)
+
(defconst ruby-end-expand-postfix-modifiers-before-re
"\\(?:if\\|unless\\|while\\)"
"Regular expression matching statements before point.")
@@ -147,6 +154,8 @@
ruby-end-expand-prefix-re)
ruby-end-expand-postfix-modifiers-before-re)))
(and
+ (or (not ruby-end-expand-only-for-last-commands)
+ (memq last-command ruby-end-expand-only-for-last-commands))
(ruby-end-code-at-point-p)
(or
(looking-back ruby-end-expand-statement-modifiers-before-re)
- [elpa] externals/ruby-end 5aba673f0e 85/91: ruby-end-code-at-point-p: Check syntax-ppss instead of text props, (continued)
- [elpa] externals/ruby-end 5aba673f0e 85/91: ruby-end-code-at-point-p: Check syntax-ppss instead of text props, ELPA Syncer, 2023/01/25
- [elpa] externals/ruby-end ea453f5ac6 82/91: Use EVM Travis binaries, ELPA Syncer, 2023/01/25
- [elpa] externals/ruby-end 8b2aaf6467 58/91: Add Travis., ELPA Syncer, 2023/01/25
- [elpa] externals/ruby-end 92dd44a4f5 35/91: Update README., ELPA Syncer, 2023/01/25
- [elpa] externals/ruby-end 5d302e1b84 43/91: Updated version to 0.2.0., ELPA Syncer, 2023/01/25
- [elpa] externals/ruby-end 8de5a68ff6 45/91: Add pkg file., ELPA Syncer, 2023/01/25
- [elpa] externals/ruby-end 338879148d 47/91: Add Makefile to run tests., ELPA Syncer, 2023/01/25
- [elpa] externals/ruby-end 1aa855419b 50/91: Add link to Youtube video in README., ELPA Syncer, 2023/01/25
- [elpa] externals/ruby-end 2be07b0259 53/91: Update version to v0.2.1., ELPA Syncer, 2023/01/25
- [elpa] externals/ruby-end cc4b8a42c3 57/91: Migrate from Carton to Cask., ELPA Syncer, 2023/01/25
- [elpa] externals/ruby-end cf55eff3f8 60/91: Merge branch 'last-command',
ELPA Syncer <=
- [elpa] externals/ruby-end 22879aa681 71/91: add hook for enhanced ruby mode, ELPA Syncer, 2023/01/25
- [elpa] externals/ruby-end 3616cedc25 83/91: Add file features/vendor/.nosearch, ELPA Syncer, 2023/01/25
- [elpa] externals/ruby-end a762ab34ac 86/91: Add the recommended second arg to looking-back calls, ELPA Syncer, 2023/01/25
- [elpa] externals/ruby-end 7c11c81583 88/91: Remove the deprecated usage of asterisks in defcustom docstrings, ELPA Syncer, 2023/01/25
- [elpa] externals/ruby-end 3a8152e42a 90/91: Bump the version, ELPA Syncer, 2023/01/25
- [elpa] externals/ruby-end 2d4097afcb 91/91: Update the copyright blurb, ELPA Syncer, 2023/01/25