[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/evil-escape 02aee7f613 079/133: New variable evil-escape-u
|
From: |
ELPA Syncer |
|
Subject: |
[nongnu] elpa/evil-escape 02aee7f613 079/133: New variable evil-escape-unordered-key-sequence |
|
Date: |
Wed, 3 Jan 2024 21:59:55 -0500 (EST) |
branch: elpa/evil-escape
commit 02aee7f613396e8a7fe4c8c2d7ea6ef84359dc37
Author: syl20bnr <sylvain.benner@gmail.com>
Commit: syl20bnr <sylvain.benner@gmail.com>
New variable evil-escape-unordered-key-sequence
Resolves #38
---
README.md | 6 ++++++
evil-escape.el | 27 ++++++++++++++++++++++++---
2 files changed, 30 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index d2b97bcff8..793aae3eb2 100644
--- a/README.md
+++ b/README.md
@@ -11,6 +11,7 @@
- [Customization](#customization)
- [Key sequence](#key-sequence)
- [Delay between keys](#delay-between-keys)
+ - [Unordered key sequence](#unordered-key-sequence)
- [Excluding a major mode](#excluding-a-major-mode)
- [Enable only for a list of major
modes](#enable-only-for-a-list-of-major-modes)
- [Assign a key binding directly](#assign-a-key-binding-directly)
@@ -86,6 +87,11 @@ composed with the two same characters it is recommended to
set the delay to
(setq-default evil-escape-delay 0.2)
```
+### Unordered key sequence
+
+The key sequence can be entered in any order by setting
+the variable `evil-escape-unordered-key-sequence` to non nil.
+
### Excluding a major mode
A major mode can be excluded by adding it to the list
diff --git a/evil-escape.el b/evil-escape.el
index d87ea48069..8f8e18aca6 100644
--- a/evil-escape.el
+++ b/evil-escape.el
@@ -5,7 +5,7 @@
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
;; Keywords: convenience editing evil
;; Created: 22 Oct 2014
-;; Version: 3.06
+;; Version: 3.07
;; Package-Requires: ((emacs "24") (evil "1.0.9"))
;; URL: https://github.com/syl20bnr/evil-escape
@@ -55,6 +55,9 @@
;; The delay between the two key presses can be customized with
;; the variable `evil-escape-delay'. Default is `0.1'.
+;; The key sequence can be entered in any order by setting
+;; the variable `evil-escape-unordered-key-sequence' to non nil.
+
;; A major mode can be excluded by adding it to the list
;; `evil-escape-excluded-major-modes'.
@@ -90,6 +93,12 @@
:type 'number
:group 'evil-escape)
+(defcustom evil-escape-unordered-key-sequence nil
+ "If non-nil then the key sequence can also be entered with the second
+key first."
+ :type 'boolean
+ :group 'evil-escape)
+
(defcustom evil-escape-excluded-major-modes nil
"Excluded major modes where escape sequences has no effect."
:type 'sexp
@@ -132,12 +141,16 @@ with a key sequence."
(when (evil-escape-p)
(let ((modified (buffer-modified-p))
(inserted (evil-escape--insert))
+ (fkey (elt evil-escape-key-sequence 0))
(skey (elt evil-escape-key-sequence 1))
(evt (read-event nil nil evil-escape-delay)))
(when inserted (evil-escape--delete))
(set-buffer-modified-p modified)
(cond
- ((and (integerp evt) (char-equal evt skey))
+ ((and (integerp evt)
+ (or (char-equal evt skey)
+ (and evil-escape-unordered-key-sequence
+ (char-equal evt fkey))))
(evil-escape)
(setq this-command 'ignore))
((null evt))
@@ -153,7 +166,9 @@ with a key sequence."
(not (memq major-mode evil-escape-excluded-major-modes))
(or (not evil-escape-enable-only-for-major-modes)
(memq major-mode evil-escape-enable-only-for-major-modes))
- (equal (this-command-keys) (evil-escape--first-key))))
+ (or (equal (this-command-keys) (evil-escape--first-key))
+ (and evil-escape-unordered-key-sequence
+ (equal (this-command-keys) (evil-escape--second-key))))))
(defun evil-escape--escape-normal-state ()
"Escape from normal state."
@@ -195,6 +210,12 @@ with a key sequence."
(fkeystr (char-to-string first-key)))
fkeystr))
+(defun evil-escape--second-key ()
+ "Return the second key string in the key sequence."
+ (let* ((sec-key (elt evil-escape-key-sequence 1))
+ (fkeystr (char-to-string sec-key)))
+ fkeystr))
+
(defun evil-escape--insert-func ()
"Default insert function."
(when (not buffer-read-only) (self-insert-command 1)))
- [nongnu] elpa/evil-escape 7fd1902fac 033/133: Fix regression in visual block, (continued)
- [nongnu] elpa/evil-escape 7fd1902fac 033/133: Fix regression in visual block, ELPA Syncer, 2024/01/03
- [nongnu] elpa/evil-escape 0e95e20437 040/133: Prevent infinite recursion if evil-escape.el is evaluated twice, ELPA Syncer, 2024/01/03
- [nongnu] elpa/evil-escape 7600904462 045/133: Fix double insert of first key in some cases, ELPA Syncer, 2024/01/03
- [nongnu] elpa/evil-escape 32a6c6c31e 102/133: Add support for compilation buffers, ELPA Syncer, 2024/01/03
- [nongnu] elpa/evil-escape 739871a837 124/133: Enforce use of spaces for indentation, ELPA Syncer, 2024/01/03
- [nongnu] elpa/evil-escape f4e9116bfb 117/133: Add a separate var for controlling mode lighter, ELPA Syncer, 2024/01/03
- [nongnu] elpa/evil-escape c3592a774e 123/133: Add minor introduction to the library commentary., ELPA Syncer, 2024/01/03
- [nongnu] elpa/evil-escape efe9a3a3d1 071/133: Simplify even more evil-escape-pre-command-hook, ELPA Syncer, 2024/01/03
- [nongnu] elpa/evil-escape c2946d8f4f 120/133: Use lexical-binding, ELPA Syncer, 2024/01/03
- [nongnu] elpa/evil-escape a7714e61b2 112/133: set `this-original-command`, ELPA Syncer, 2024/01/03
- [nongnu] elpa/evil-escape 02aee7f613 079/133: New variable evil-escape-unordered-key-sequence,
ELPA Syncer <=
- [nongnu] elpa/evil-escape 25920fb2f4 114/133: Bump version to 3.15, ELPA Syncer, 2024/01/03
- [nongnu] elpa/evil-escape 8683314f68 127/133: Depend on Emacs 26 or later, ELPA Syncer, 2024/01/03
- [nongnu] elpa/evil-escape b4d44fc501 111/133: Bump version to 3.14, ELPA Syncer, 2024/01/03
- [nongnu] elpa/evil-escape 9c8799446f 080/133: Add support for spacemacs hybrid-state and fix emacs state, ELPA Syncer, 2024/01/03
- [nongnu] elpa/evil-escape b159b4307e 074/133: Allow evil-escape in motion state, ELPA Syncer, 2024/01/03
- [nongnu] elpa/evil-escape 9164cdad0b 075/133: Fix evil-escape--escape-motion-state syntax error, ELPA Syncer, 2024/01/03
- [nongnu] elpa/evil-escape 7603a2f288 092/133: Fix broken interactive evil-escape function, ELPA Syncer, 2024/01/03
- [nongnu] elpa/evil-escape f62630c7d6 070/133: Simplify evil-escape-pre-command-hook, ELPA Syncer, 2024/01/03
- [nongnu] elpa/evil-escape 3d3c941db8 082/133: add evil escape suppressed predicates., ELPA Syncer, 2024/01/03
- [nongnu] elpa/evil-escape 9f7ed13160 086/133: Add support for read-only buffers, ELPA Syncer, 2024/01/03