branch: elpa/buttercup
commit 9a354a68f883c3f853ef10b88f5f428e5e3507b6
Author: Ola Nilsson <ola.nils...@gmail.com>
Commit: Ola Nilsson <ola.nils...@gmail.com>

    test: Use gensym instead of cl-gensym if available
    
    The replacement function gensym was added in Emacs 26.1, and buttercup
    still supports Emacs 24.4.
---
 tests/test-buttercup.el | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tests/test-buttercup.el b/tests/test-buttercup.el
index 4da26dea2f..5ebbe0265d 100644
--- a/tests/test-buttercup.el
+++ b/tests/test-buttercup.el
@@ -82,6 +82,12 @@ variables or environment variables while executing BODY:
                                   )
        ,@body))))
 
+(defmacro buttercup--gensym (&optional prefix)
+  "Generate a new uninterned symbol.
+The name is made by appending a number to PREFIX, default \"G\".
+Uses `gensym' if available, otherwise `cl-gensym'."
+  `(,(if (fboundp 'gensym) 'gensym 'cl-gensym) ,prefix))
+
 (defmacro buttercup--test-with-tempdir (files &rest body)
   "Create FILES and execute BODY in a temporary directory.
 FILES shall be a list of file names. An empty file with that name
@@ -91,8 +97,8 @@ can also be a list of up to two elements where the first is 
the
 filename as above and the second is the file contents.
 Return the value of the last form in BODY."
   (declare (debug t) (indent defun))
-  (let ((tmproot (cl-gensym))
-        (olddir (cl-gensym)))
+  (let ((tmproot (buttercup--gensym))
+        (olddir  (buttercup--gensym)))
     `(let ((,tmproot (make-temp-file "buttercup-test-temp-" t))
            (,olddir default-directory))
        (cl-labels ((make-file (file &optional content)

Reply via email to