(require 'cl-lib)
(require 'tabulated-list)
+;; Declare a synthetic theme for :custom variables.
+;; Necessary in order to avoid having those variables saved by custom.el.
+(deftheme use-package)
+(enable-theme 'use-package)
+
(if (and (eq emacs-major-version 24) (eq emacs-minor-version 3))
(defsubst hash-table-keys (hash-table)
"Return a list of keys in HASH-TABLE."
(comment (nth 2 def)))
(unless (and comment (stringp comment))
(setq comment (format "Customized with use-package %s" name)))
- `(customize-set-variable (quote ,variable) ,value ,comment)
- `(put ',variable 'theme-value '((use-package-synthetic-theme ignore-just-for-saving)))))
+ `(let ((custom--inhibit-theme-enable nil))
+ (custom-theme-set-variables 'use-package
+ '(,variable ,value nil () ,comment)))))
args)
(use-package-process-keywords name rest state)))
;; '((foo bar baz))))
))
+
(ert-deftest use-package-test/:custom-1 ()
(match-expansion
(use-package foo :custom (foo bar))
`(progn
- (funcall
- (or
- (get 'foo 'custom-set)
- (function set-default))
- 'foo bar)
- (set 'foo 'saved-variable-comment "Customized with use-package foo")
+ (let
+ ((custom--inhibit-theme-enable nil))
+ (custom-theme-set-variables 'use-package
+ '(foo bar nil nil "Customized with use-package foo")))
(require 'foo nil nil))))
(ert-deftest use-package-test/:custom-with-comment1 ()
(match-expansion
(use-package foo :custom (foo bar "commented"))
`(progn
- (funcall
- (or
- (get 'foo 'custom-set)
- (function set-default))
- 'foo bar)
- (set 'foo 'saved-variable-comment "commented")
+ (let
+ ((custom--inhibit-theme-enable nil))
+ (custom-theme-set-variables 'use-package
+ '(foo bar nil nil "commented")))
(require 'foo nil nil))))
(ert-deftest use-package-test/:custom-face-1 ()