summaryrefslogtreecommitdiff
path: root/evil-surround.el
diff options
context:
space:
mode:
authorTom Dalziel <tom_dl@hotmail.com>2023-09-12 19:05:05 +0200
committerTom Dalziel <tom_dl@hotmail.com>2023-09-12 19:05:05 +0200
commit0d860be74165ceb8314742e4191cdad693f40a6d (patch)
tree07abbfe3b2310540bacc5ed8f9e272ec9a3be699 /evil-surround.el
parentb11048d92aa253d59097a82398e142453c809692 (diff)
Fix get-delims to allow functions as values
Diffstat (limited to 'evil-surround.el')
-rw-r--r--evil-surround.el11
1 files changed, 8 insertions, 3 deletions
diff --git a/evil-surround.el b/evil-surround.el
index 6a47d1f..aa7348f 100644
--- a/evil-surround.el
+++ b/evil-surround.el
@@ -291,9 +291,14 @@ This overlay excludes the delimeters."
(defun evil-surround--get-delims (char)
"Given a CHAR, return delims from the pairs alist. Trim whitespace."
- (cl-destructuring-bind (&optional k . (o . c)) (assoc char evil-surround-pairs-alist)
- (when k
- (cons (string-trim o) (string-trim c)))))
+ (let ((kv-pair (assoc char evil-surround-pairs-alist)))
+ (when kv-pair
+ (let* ((delims (cdr kv-pair))
+ (o (car-safe delims))
+ (c (cdr-safe delims)))
+ (if (and (stringp o) (stringp c))
+ (cons (string-trim o) (string-trim c))
+ delims)))))
;;;###autoload
(defun evil-surround-delete (char &optional outer inner)