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

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

[nongnu] elpa/evil-escape 5c5b1a655c 076/133: Add new defcustom evil-esc


From: ELPA Syncer
Subject: [nongnu] elpa/evil-escape 5c5b1a655c 076/133: Add new defcustom evil-escape-enable-only-for-major-modes
Date: Wed, 3 Jan 2024 21:59:54 -0500 (EST)

branch: elpa/evil-escape
commit 5c5b1a655cf8600af9fd8dea8f60763474c82b45
Author: syl20bnr <sylvain.benner@gmail.com>
Commit: syl20bnr <sylvain.benner@gmail.com>

    Add new defcustom evil-escape-enable-only-for-major-modes
    
    Fixes #36
---
 README.md      | 11 ++++++++++-
 evil-escape.el | 16 ++++++++++++++--
 2 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index 9808d7cea3..75a5011b58 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
 
[![MELPA](http://melpa.org/packages/evil-escape-badge.svg)](http://melpa.org/#/evil-escape)
 [![MELPA 
Stable](http://stable.melpa.org/packages/evil-escape-badge.svg)](http://stable.melpa.org/#/evil-escape)
 
-<!-- markdown-toc start - Don't edit this section. Run M-x 
markdown-toc/generate-toc again -->
+<!-- markdown-toc start - Don't edit this section. Run M-x 
markdown-toc-generate-toc again -->
 **Table of Contents**
 
 - [evil-escape](#evil-escape)
@@ -11,6 +11,8 @@
     - [Customization](#customization)
         - [Key sequence](#key-sequence)
         - [Delay between keys](#delay-between-keys)
+        - [Excluding a major mode](#excluding-a-major-mode)
+        - [Enable only for a list of major 
modes](#enable-only-for-a-list-of-major-modes)
 
 <!-- markdown-toc end -->
 
@@ -88,4 +90,11 @@ composed with the two same characters it is recommended to 
set the delay to
 A major mode can be excluded by adding it to the list
 `evil-escape-excluded-major-modes`.
 
+### Enable only for a list of major modes
+
+It is also possible to provide an inclusive list of major modes
+with the variable `evil-escape-enable-only-for-major-modes`. When this list
+non-nil then evil-escape is enabled only for the major-modes contained in the
+list.
+
 [MELPA]: http://melpa.org/
diff --git a/evil-escape.el b/evil-escape.el
index 442a4b6ac0..4d6a88903e 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.03
+;; Version: 3.04
 ;; Package-Requires: ((emacs "24") (evil "1.0.9"))
 ;; URL: https://github.com/syl20bnr/evil-escape
 
@@ -58,6 +58,11 @@
 ;; A major mode can be excluded by adding it to the list
 ;; `evil-escape-excluded-major-modes'.
 
+;; It is also possible to provide an inclusive list of major modes
+;; with the variable `evil-escape-enable-only-for-major-modes'. When this list
+;; non-nil then evil-escape is enabled only for the major-modes contained in 
the
+;; list.
+
 ;; More information in the readme of the repository:
 ;; https://github.com/syl20bnr/evil-escape
 
@@ -80,11 +85,16 @@
   :type 'number
   :group 'evil-escape)
 
-(defcustom evil-escape-excluded-major-modes '()
+(defcustom evil-escape-excluded-major-modes nil
   "Excluded major modes where escape sequences has no effect."
   :type 'sexp
   :group 'evil-escape)
 
+(defcustom evil-escape-enable-only-for-major-modes nil
+  "List of major modes where evil-escape is enabled."
+  :type 'sexp
+  :group 'evil-escape)
+
 ;;;###autoload
 (define-minor-mode evil-escape-mode
   "Buffer-local minor mode to escape insert state and everythin else
@@ -120,6 +130,8 @@ with a key sequence."
            (and (fboundp 'helm-alive-p) (helm-alive-p))
            (not (eq evil-state 'normal)))
        (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))))
 
 (defun evil-escape--escape ()



reply via email to

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