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

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

[nongnu] elpa/evil-lisp-state 45bbdfce7f 072/125: Insert sibling before/


From: ELPA Syncer
Subject: [nongnu] elpa/evil-lisp-state 45bbdfce7f 072/125: Insert sibling before/after bindings on `(` and `)` respectively
Date: Thu, 6 Jan 2022 04:58:42 -0500 (EST)

branch: elpa/evil-lisp-state
commit 45bbdfce7ffaea08ac9196c02133a302d911e2b3
Author: syl20bnr <sylvain.benner@gmail.com>
Commit: syl20bnr <sylvain.benner@gmail.com>

    Insert sibling before/after bindings on `(` and `)` respectively
---
 README.md          |  3 ++-
 evil-lisp-state.el | 31 +++++++++++++++++--------------
 2 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/README.md b/README.md
index eebc032e01..d61f1c11b0 100644
--- a/README.md
+++ b/README.md
@@ -101,7 +101,8 @@ to default `<tab>`):
 
 Key Binding   | Function
 --------------|------------------------------------------------------------
-`(`           | switch to `insert state` and insert "("
+`(`           | insert sibling before sexp and switch to `insert state`
+`)`           | insert sibling after sexp and switch to `insert state`
 `%`           | evil-jump-item (use it to go to the end of sexp)
 `$`           | sp-end-of-sexp
 `0`           | sp-beginning-of-sexp
diff --git a/evil-lisp-state.el b/evil-lisp-state.el
index 1a76af7595..3c2a8af5d7 100644
--- a/evil-lisp-state.el
+++ b/evil-lisp-state.el
@@ -93,7 +93,8 @@ of COMMAND.
            (define-key evil-lisp-state-map (kbd bkey) bcmdsym)))))
 
 ;; key bindings
-(define-key evil-lisp-state-map "("   'evil-lisp-state-insert-left-paren)
+(define-key evil-lisp-state-map "("   'evil-lisp-state-insert-sexp-before)
+(define-key evil-lisp-state-map ")"   'evil-lisp-state-insert-sexp-after)
 (define-key evil-lisp-state-map "1"   'digit-argument)
 (define-key evil-lisp-state-map "2"   'digit-argument)
 (define-key evil-lisp-state-map "3"   'digit-argument)
@@ -189,22 +190,24 @@ of COMMAND.
 (defun evil-lisp-state-insert-sexp-after ()
   "Insert sexp after the current one."
   (interactive)
-  (if (char-equal (char-after) ?\() (evil-lisp-state-forward-symbol))
-  (sp-up-sexp)
-  (evil-insert-state)
-  (sp-newline)
-  (sp-insert-pair "("))
+  (let ((sp-navigate-consider-symbols nil))
+    (if (char-equal (char-after) ?\() (evil-lisp-state-forward-symbol))
+    (sp-up-sexp)
+    (evil-insert-state)
+    (sp-newline)
+    (sp-insert-pair "(")))
 
 (defun evil-lisp-state-insert-sexp-before ()
   "Insert sexp before the current one."
   (interactive)
-  (if (char-equal (char-after) ?\() (evil-lisp-state-forward-symbol))
-  (sp-backward-sexp)
-  (evil-insert-state)
-  (sp-newline)
-  (evil-previous-visual-line)
-  (evil-end-of-line)
-  (sp-insert-pair "(")
-  (indent-for-tab-command))
+  (let ((sp-navigate-consider-symbols nil))
+    (if (char-equal (char-after) ?\() (evil-lisp-state-forward-symbol))
+    (sp-backward-sexp)
+    (evil-insert-state)
+    (sp-newline)
+    (evil-previous-visual-line)
+    (evil-end-of-line)
+    (sp-insert-pair "(")
+    (indent-for-tab-command)))
 
 (provide 'evil-lisp-state)



reply via email to

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