1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

Create new "use-package" themse and use it for :custom with custom-theme-set-variables

This commit is contained in:
Ted Zlatanov 2020-11-29 12:23:02 +00:00
parent 5ceb51ae19
commit a3c310c11a
2 changed files with 17 additions and 14 deletions

View file

@ -43,6 +43,11 @@
(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."
@ -1394,8 +1399,9 @@ no keyword implies `:all'."
(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)))

View file

@ -1129,28 +1129,25 @@
;; '((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 ()