[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ruby-end 19037b0c8c 59/91: Add new option, ruby-end-exp
From: |
ELPA Syncer |
Subject: |
[elpa] externals/ruby-end 19037b0c8c 59/91: Add new option, ruby-end-expand-only-for-last-commands |
Date: |
Wed, 25 Jan 2023 19:58:28 -0500 (EST) |
branch: externals/ruby-end
commit 19037b0c8c5eb31626664d685f967509c45325d2
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>
Add new option, ruby-end-expand-only-for-last-commands
---
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 0bd59d9eef 67/91: Add ert.el for Emacs-23., (continued)
- [elpa] externals/ruby-end 0bd59d9eef 67/91: Add ert.el for Emacs-23., ELPA Syncer, 2023/01/25
- [elpa] externals/ruby-end d6bb876c4f 63/91: Use package-file instead of package., ELPA Syncer, 2023/01/25
- [elpa] externals/ruby-end 1b4700171d 73/91: Release v0.4.0., ELPA Syncer, 2023/01/25
- [elpa] externals/ruby-end 95fab5058f 70/91: Bump the version, ELPA Syncer, 2023/01/25
- [elpa] externals/ruby-end 7598edc655 75/91: Merge branch 'fix-autoload', ELPA Syncer, 2023/01/25
- [elpa] externals/ruby-end a136f75abb 84/91: Merge pull request #16 from tarsius/master, ELPA Syncer, 2023/01/25
- [elpa] externals/ruby-end c56f65e9ae 78/91: Fix travis badge [skip ci], ELPA Syncer, 2023/01/25
- [elpa] externals/ruby-end 61a740d02b 87/91: Fix the edmacro warning, ELPA Syncer, 2023/01/25
- [elpa] externals/ruby-end 0d2634e769 41/91: Merge branch 'expand-on-ret', ELPA Syncer, 2023/01/25
- [elpa] externals/ruby-end 17a6b4eff0 55/91: Make sure we start ruby-end-mode in ruby-mode., ELPA Syncer, 2023/01/25
- [elpa] externals/ruby-end 19037b0c8c 59/91: Add new option, ruby-end-expand-only-for-last-commands,
ELPA Syncer <=
- [elpa] externals/ruby-end 01ed4038da 66/91: Add gnu source., ELPA Syncer, 2023/01/25
- [elpa] externals/ruby-end 337ff42f60 72/91: Merge branch 'add_hook_for_enh_ruby_mode', ELPA Syncer, 2023/01/25
- [elpa] externals/ruby-end a3d309c8da 80/91: Use generic langauge on Travis, ELPA Syncer, 2023/01/25
- [elpa] externals/ruby-end 95544f5e9e 76/91: Update Travis config, ELPA Syncer, 2023/01/25
- [elpa] externals/ruby-end 6c7c8e5e21 37/91: Require ruby-mode., ELPA Syncer, 2023/01/25
- [elpa] externals/ruby-end 9ec6d1b7e5 54/91: Do not activate ruby-end-mode in features., ELPA Syncer, 2023/01/25
- [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