branch: master
commit 5c559f53417867b5cf8f616e7b5f935f04b5a73c
Author: Basil L. Contovounesios <[email protected]>
Commit: Oleh Krehel <[email protected]>
ivy-test.el (ivy-with-r): Use with-output-to-string
- Reuse existing macro logic.
- Minimise side effects by passing non-nil NORECORD arg to
switch-to-buffer.
- Consistently quote function symbols as such.
Fixes #1300
---
ivy-test.el | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/ivy-test.el b/ivy-test.el
index 117fdca..af6982e 100644
--- a/ivy-test.el
+++ b/ivy-test.el
@@ -574,17 +574,13 @@ will bring the behavior in line with the newer Emacsen."
"bl")))
(defmacro ivy-with-r (expr &rest keys)
- `(let ((temp-buffer (generate-new-buffer " *temp*")))
- (unwind-protect
- (save-window-excursion
- (switch-to-buffer temp-buffer)
- ,expr
- (ivy-mode)
- (execute-kbd-macro
- ,(apply 'vconcat (mapcar 'kbd keys)))
- (buffer-string))
- (and (buffer-name temp-buffer)
- (kill-buffer temp-buffer)))))
+ `(with-output-to-string
+ (save-window-excursion
+ (switch-to-buffer standard-output t)
+ ,expr
+ (ivy-mode)
+ (execute-kbd-macro
+ ,(apply #'vconcat (mapcar #'kbd keys))))))
(ert-deftest ivy-completion-in-region ()
(should (string=