;;; Utility functions
;;
+(defvar use-package-gensym-counter 0
+ "Number used to construct the name of the next symbol created
+by `use-package-gensym'.")
+
+(defun use-package-gensym (&optional prefix)
+ "Return a new uninterned symbol.
+The name is made by appending `gensym-counter' to PREFIX.
+PREFIX is a string, and defaults to \"g\"."
+ (let ((num (prog1 use-package-gensym-counter
+ (setq use-package-gensym-counter
+ (1+ use-package-gensym-counter)))))
+ (make-symbol (format "%s%d" (or prefix "g") num))))
+
(defsubst use-package-error (msg)
"Report MSG as an error, so the user knows it came from this package."
(error "use-package: %s" msg))
(defun use-package-memoize (f arg)
"Ensure the macro-expansion of F applied to ARG evaluates ARG
no more than once."
- (let ((loaded (gensym "use-package--loaded"))
- (result (gensym "use-package--result"))
- (next (gensym "use-package--next")))
+ (let ((loaded (use-package-gensym "use-package--loaded"))
+ (result (use-package-gensym "use-package--result"))
+ (next (use-package-gensym "use-package--next")))
`((lexical-let (,loaded ,result)
(lexical-let ((,next (lambda ()
(if ,loaded
use-package--hush-function)))
(defun use-package-handler/:catch (name keyword arg rest state)
- (let* ((context (gensym "use-package--warning")))
+ (let* ((context (use-package-gensym "use-package--warning")))
(cond
((not arg)
(use-package-process-keywords name rest state))