diff options
| author | Tom Dalziel <tom_dl@hotmail.com> | 2023-06-27 21:52:46 +0100 |
|---|---|---|
| committer | Tom Dalziel <tom_dl@hotmail.com> | 2023-06-27 21:52:46 +0100 |
| commit | 4a21d756b76a50e0c0619555836c9aa98f103d3d (patch) | |
| tree | ea69bb8578d7b8f99aa4237d6436063a1176ed56 | |
| parent | e46c455c7d50af1d8b5537d1e2f1a611f1ec73f4 (diff) | |
Revert "Enable lexical binding"
This reverts commit 2d878b6ccefe0f39216a178cefdc3f0fa2aa7fef.
| -rw-r--r-- | evil-surround.el | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/evil-surround.el b/evil-surround.el index 2426aa6..b6fbe73 100644 --- a/evil-surround.el +++ b/evil-surround.el @@ -1,4 +1,4 @@ -;;; evil-surround.el --- emulate surround.vim from Vim -*- lexical-binding: t; -*- +;;; evil-surround.el --- emulate surround.vim from Vim ;; Copyright (C) 2010 - 2017 Tim Harper ;; Copyright (C) 2018 - 2020 The evil-surround.el Contributors @@ -115,11 +115,6 @@ Each item is of the form (OPERATOR . OPERATION)." (defvar evil-surround-last-deleted-left "" "The previously deleted LEFT region.") -(defvar evil-surround-current-pair nil - "The current pair. - -When non-nil, it can be either a cons or a function returning a cons.") - (defun evil-surround-read-from-minibuffer (&rest args) (when (or evil-surround-record-repeat (evil-repeat-recording-p)) @@ -195,13 +190,13 @@ function call in prefixed form." (defun evil-surround-pair (char) "Return the evil-surround pair of char. This is a cons cell (LEFT . RIGHT), both strings." - (let ((evil-surround-current-pair (assoc-default char evil-surround-pairs-alist))) + (let ((pair (assoc-default char evil-surround-pairs-alist))) (cond - ((functionp evil-surround-current-pair) - (funcall evil-surround-current-pair)) + ((functionp pair) + (funcall pair)) - ((consp evil-surround-current-pair) - evil-surround-current-pair) + ((consp pair) + pair) (t (cons (format "%c" char) (format "%c" char)))))) @@ -411,9 +406,9 @@ Becomes this: (when (evil-surround-valid-char-p char) (let* ((overlay (make-overlay beg end nil nil t)) - (evil-surround-current-pair (or evil-surround-current-pair (evil-surround-pair char))) - (open (car evil-surround-current-pair)) - (close (cdr evil-surround-current-pair)) + (pair (or (and (boundp 'pair) pair) (evil-surround-pair char))) + (open (car pair)) + (close (cdr pair)) (beg-pos (overlay-start overlay))) (unwind-protect (progn |
