From a3803cfb514180de3ce14727b293afd92e10f4bd Mon Sep 17 00:00:00 2001 From: "James N. V. Cash" Date: Fri, 13 Dec 2019 10:42:27 -0500 Subject: Add a test for surrounding with a tag in a macro Not using `evil-test-buffer`, as it doesn't seem to play well with this kind of testing a kbd macro. Also slightly different from the already-present tests for surrounding with tags, because it does additional things after wrapping -- without the included change, this surrounds with a `
` tag, but also inserts the following keys as well, instead of treating them as commands. --- test/evil-surround-test.el | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/evil-surround-test.el b/test/evil-surround-test.el index 0ab98de..763aa44 100644 --- a/test/evil-surround-test.el +++ b/test/evil-surround-test.el @@ -243,3 +243,18 @@ "[w]ord" ("ysiwb") "[(]word)"))) + +(ert-deftest evil-surround-tag-from-macro () + (ert-info ("tag surround in macro") + (save-window-excursion + (with-current-buffer (get-buffer-create "*evil-surround-tag-from-macro*") + (switch-to-buffer-other-window (current-buffer)) + (insert "foo\nbar\nbaz\n") + (goto-char (point-min)) + (evil-mode 1) + (turn-on-evil-surround-mode) + (execute-kbd-macro + "yse
f>lysit$j_") + (should + (string= "
$foo$
\nbar\nbaz\n" + (buffer-substring-no-properties (point-min) (point-max)))))))) -- cgit v1.0 From 01eb3c0e4f4d5992902641be79fb823067f493db Mon Sep 17 00:00:00 2001 From: "James N. V. Cash" Date: Fri, 13 Dec 2019 10:44:42 -0500 Subject: Remove apparently-unnecessary run-at-time Fixes issue when surrounding with a tag from a macro --- evil-surround.el | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/evil-surround.el b/evil-surround.el index 6a92d08..da4e549 100644 --- a/evil-surround.el +++ b/evil-surround.el @@ -91,11 +91,9 @@ Each item is of the form (OPERATOR . OPERATION)." (define-key map ">" (lambda () (interactive) (call-interactively 'self-insert-command) - (run-at-time nil nil - (lambda () - (when (active-minibuffer-window) - (select-window (active-minibuffer-window)) - (exit-minibuffer)))))) + (when (active-minibuffer-window) + (select-window (active-minibuffer-window)) + (exit-minibuffer)))) map) "Keymap used by `evil-surround-read-tag'.") -- cgit v1.0 From b670e5f338175a1cbeaa1f0c16296f357adf1625 Mon Sep 17 00:00:00 2001 From: "James N. V. Cash" Date: Sun, 15 Dec 2019 19:16:00 -0500 Subject: Checking minibuffer window doesn't seem to make a difference either --- evil-surround.el | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/evil-surround.el b/evil-surround.el index da4e549..8611e59 100644 --- a/evil-surround.el +++ b/evil-surround.el @@ -90,10 +90,8 @@ Each item is of the form (OPERATOR . OPERATION)." (let ((map (copy-keymap minibuffer-local-map))) (define-key map ">" (lambda () (interactive) - (call-interactively 'self-insert-command) - (when (active-minibuffer-window) - (select-window (active-minibuffer-window)) - (exit-minibuffer)))) + (call-interactively #'self-insert-command) + (exit-minibuffer))) map) "Keymap used by `evil-surround-read-tag'.") -- cgit v1.0