[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/evil-surround 1a4bc20f15 135/175: add csw, csW, css and cs
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/evil-surround 1a4bc20f15 135/175: add csw, csW, css and csp shortcuts |
Date: |
Mon, 9 Oct 2023 13:01:09 -0400 (EDT) |
branch: elpa/evil-surround
commit 1a4bc20f158aa9f4e4811a6363cc65ea24f167ce
Author: tam5 <arimiller92@gmail.com>
Commit: tam5 <arimiller92@gmail.com>
add csw, csW, css and csp shortcuts
---
evil-surround.el | 10 +++++++++-
test/evil-surround-test.el | 12 ++++++++++++
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/evil-surround.el b/evil-surround.el
index 854c42fb9b..383c0fd245 100644
--- a/evil-surround.el
+++ b/evil-surround.el
@@ -137,6 +137,13 @@ Each item is of the form (OPERATOR . OPERATION)."
"Returns whether CHAR is a valid surround char or not."
(not (memq char '(?\C-\[ ?\C-?))))
+(defun evil-surround-delete-char-noop-p (char)
+ "Returns whether CHAR is a noop when used with surround delete."
+ (memq char (list (string-to-char "w")
+ (string-to-char "W")
+ (string-to-char "s")
+ (string-to-char "p"))))
+
(defun evil-surround-pair (char)
"Return the evil-surround pair of char.
This is a cons cell (LEFT . RIGHT), both strings."
@@ -232,7 +239,8 @@ overlays OUTER and INNER, which are passed to
`evil-surround-delete'."
(interactive (evil-surround-input-char))
(cond
((and outer inner)
- (evil-surround-delete char outer inner)
+ (unless (evil-surround-delete-char-noop-p char)
+ (evil-surround-delete char outer inner))
(let ((key (evil-surround-read-char)))
(evil-surround-region (overlay-start outer)
(overlay-end outer)
diff --git a/test/evil-surround-test.el b/test/evil-surround-test.el
index df8a03f2bb..df71b11647 100644
--- a/test/evil-surround-test.el
+++ b/test/evil-surround-test.el
@@ -37,6 +37,18 @@
"one 'two' three"
("ds'")
"one two three"))
+ (ert-info ("shortcut surrounding")
+ (evil-test-buffer
+ "One, and two. Also three.\n\n"
+ (turn-on-evil-surround-mode)
+ ("csw)")
+ "(One), and two. Also three.\n\n"
+ ("csW'")
+ "'(One),' and two. Also three.\n\n"
+ ("css.")
+ ".'(One),' and two. Also three..\n\n"
+ ("csp0")
+ "0.'(One),' and two. Also three..0\n\n"))
(ert-info ("examples from readme")
(evil-test-buffer
:visual-start nil
- [nongnu] elpa/evil-surround a92151def9 129/175: Revert "surround-function improvement for lisp modes (#134)", (continued)
- [nongnu] elpa/evil-surround a92151def9 129/175: Revert "surround-function improvement for lisp modes (#134)", ELPA Syncer, 2023/10/09
- [nongnu] elpa/evil-surround 2af81ab3ac 127/175: fix readme on how to add a new surround pair, ELPA Syncer, 2023/10/09
- [nongnu] elpa/evil-surround 7780daa573 169/175: Support multiple-character delimiter deletion, ELPA Syncer, 2023/10/09
- [nongnu] elpa/evil-surround 897203ca5f 134/175: update readme: copyright years, ELPA Syncer, 2023/10/09
- [nongnu] elpa/evil-surround 7236499c43 148/175: fix typos in the readme, ELPA Syncer, 2023/10/09
- [nongnu] elpa/evil-surround 8449d19d05 158/175: Fix visual screen-line surrounding bug., ELPA Syncer, 2023/10/09
- [nongnu] elpa/evil-surround 346d4d85fc 150/175: Fix dot repeat with counted motions, ELPA Syncer, 2023/10/09
- [nongnu] elpa/evil-surround d210e1fc2c 140/175: main el file: add dots and caps to evil-surround-tag-name-re, ELPA Syncer, 2023/10/09
- [nongnu] elpa/evil-surround 8069f9c2f3 147/175: trying to update travis configuration, ELPA Syncer, 2023/10/09
- [nongnu] elpa/evil-surround e46c455c7d 167/175: Silence byte-compiler warnings, ELPA Syncer, 2023/10/09
- [nongnu] elpa/evil-surround 1a4bc20f15 135/175: add csw, csW, css and csp shortcuts,
ELPA Syncer <=
- [nongnu] elpa/evil-surround 1c34944d8c 149/175: remove emacs 24 and 25 from the build pipeline, ELPA Syncer, 2023/10/09
- [nongnu] elpa/evil-surround 9e445b7ab1 136/175: main el file: fix version to 1.0.3, ELPA Syncer, 2023/10/09
- [nongnu] elpa/evil-surround 8fad8540c4 172/175: Revert "Revert "Enable lexical binding"", ELPA Syncer, 2023/10/09
- [nongnu] elpa/evil-surround a0ac30158d 113/175: add @edkolev's custom logo, ELPA Syncer, 2023/10/09
- [nongnu] elpa/evil-surround 3bd73794ee 153/175: Fix yss behavior with visual-line-mode, ELPA Syncer, 2023/10/09
- [nongnu] elpa/evil-surround 33bb00787a 053/175: Merge pull request #54 from hlissner/fix-esc-surround, ELPA Syncer, 2023/10/09
- [nongnu] elpa/evil-surround 491e17093b 072/175: Generalize operator surround detection, ELPA Syncer, 2023/10/09
- [nongnu] elpa/evil-surround 852a7bae12 006/175: when deleting surround with left-bracket (, {.[... etc... trim the space inside the region, ELPA Syncer, 2023/10/09
- [nongnu] elpa/evil-surround fd421b573f 032/175: Fix doc for surround delete operator, ELPA Syncer, 2023/10/09
- [nongnu] elpa/evil-surround 5e6bcb38e9 046/175: support for yS, vgS, ELPA Syncer, 2023/10/09