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

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

[nongnu] elpa/evil-surround 2d878b6cce 166/175: Enable lexical binding


From: ELPA Syncer
Subject: [nongnu] elpa/evil-surround 2d878b6cce 166/175: Enable lexical binding
Date: Mon, 9 Oct 2023 13:01:16 -0400 (EDT)

branch: elpa/evil-surround
commit 2d878b6ccefe0f39216a178cefdc3f0fa2aa7fef
Author: Brian Leung <leungbk@posteo.net>
Commit: Tom Dalziel <33435574+tomdl89@users.noreply.github.com>

    Enable lexical binding
---
 evil-surround.el | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/evil-surround.el b/evil-surround.el
index 0fd2cad6a0..0c8bfa13b5 100644
--- a/evil-surround.el
+++ b/evil-surround.el
@@ -1,4 +1,4 @@
-;;; evil-surround.el --- emulate surround.vim from Vim
+;;; evil-surround.el --- emulate surround.vim from Vim  -*- lexical-binding: 
t; -*-
 
 ;; Copyright (C) 2010 - 2017 Tim Harper
 ;; Copyright (C) 2018 - 2020 The evil-surround.el Contributors
@@ -115,6 +115,11 @@ 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))
@@ -190,13 +195,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 ((pair (assoc-default char evil-surround-pairs-alist)))
+  (let ((evil-surround-current-pair (assoc-default char 
evil-surround-pairs-alist)))
     (cond
-     ((functionp pair)
-      (funcall pair))
+     ((functionp evil-surround-current-pair)
+      (funcall evil-surround-current-pair))
 
-     ((consp pair)
-      pair)
+     ((consp evil-surround-current-pair)
+      evil-surround-current-pair)
 
      (t
       (cons (format "%c" char) (format "%c" char))))))
@@ -403,9 +408,9 @@ Becomes this:
 
   (when (evil-surround-valid-char-p char)
     (let* ((overlay (make-overlay beg end nil nil t))
-           (pair (or (and (boundp 'pair) pair) (evil-surround-pair char)))
-           (open (car pair))
-           (close (cdr pair))
+           (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))
            (beg-pos (overlay-start overlay)))
       (unwind-protect
           (progn



reply via email to

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