summaryrefslogtreecommitdiff
path: root/evil-surround.el
diff options
context:
space:
mode:
authorDickby <felix.dick@web.de>2018-01-02 15:01:37 +0100
committerFilipe Silva <ninrod@users.noreply.github.com>2018-01-02 12:01:37 -0200
commit5a20c9757eff64e1567d313eb254126aef2bf3b2 (patch)
tree25ccef3dc7734610ad5d49ed303ff7046aae3e7f /evil-surround.el
parent6e1da767ec7f8e6dca41b2a97edd7c1be9752ffa (diff)
surround-function improvement for lisp modes (#134)
surround-function improvement for lisp modes
Diffstat (limited to 'evil-surround.el')
-rw-r--r--evil-surround.el35
1 files changed, 32 insertions, 3 deletions
diff --git a/evil-surround.el b/evil-surround.el
index fbcaee7..3478bd1 100644
--- a/evil-surround.el
+++ b/evil-surround.el
@@ -76,6 +76,34 @@ This only affects inserting pairs, not deleting or changing them."
(function :tag "Function"))))
(make-variable-buffer-local 'evil-surround-pairs-alist)
+(defcustom evil-surround-lisp-modes '(
+ cider-repl-mode
+ clojure-mode
+ clojurec-mode
+ clojurescript-mode
+ clojurex-mode
+ common-lisp-mode
+ emacs-lisp-mode
+ eshell-mode
+ geiser-repl-mode
+ inf-clojure-mode
+ inferior-emacs-lisp-mode
+ inferior-lisp-mode
+ inferior-scheme-mode
+ lisp-interaction-mode
+ lisp-mode
+ monroe-mode
+ racket-mode
+ racket-repl-mode
+ scheme-interaction-mode
+ scheme-mode
+ slime-repl-mode
+ stumpwm-mode
+ )
+ "List of Lisp-related modes."
+ :type '(repeat symbol)
+ :group 'evil-surround)
+
(defcustom evil-surround-operator-alist
'((evil-change . change)
(evil-delete . delete))
@@ -105,8 +133,9 @@ Each item is of the form (OPERATOR . OPERATION)."
(defun evil-surround-function ()
"Read a functionname from the minibuffer and wrap selection in function call"
(let ((fname (evil-surround-read-from-minibuffer "" "")))
- (cons (format "%s(" (or fname ""))
- ")")))
+ (cons (format (if (member major-mode evil-surround-lisp-modes)
+ "(%s " "%s(")
+ (or fname "")) ")")))
(defun evil-surround-read-tag ()
"Read a XML tag from the minibuffer."
@@ -157,7 +186,7 @@ See also `evil-surround-inner-overlay'."
(while (looking-at regexp) (forward-char))
(evil-set-range-beginning range (point))
(goto-char (evil-range-end range))
- (while (looking-back regexp) (backward-char))
+ (while (looking-back regexp nil) (backward-char))
(evil-set-range-end range (point))))))
(defun evil-surround-inner-overlay (char)