diff options
| author | John Wiegley | 2021-01-06 13:45:39 -0800 |
|---|---|---|
| committer | GitHub | 2021-01-06 13:45:39 -0800 |
| commit | 3ffb662dccaed79df073f3a77639285f93b98d2b (patch) | |
| tree | 5435aa0746f5c8595c66291bcfbd642d821d31c0 | |
| parent | 99643f8873e4181df7c1f61fa2bfb7d3b432b9db (diff) | |
| parent | a3c310c11a9ec311a4028d7ce8da4c2fd204a46b (diff) | |
| download | emacs-3ffb662dccaed79df073f3a77639285f93b98d2b.tar.gz emacs-3ffb662dccaed79df073f3a77639285f93b98d2b.zip | |
Merge pull request from tzz/tzz/set-comment-and-synthetic-theme
GitHub-reference: https://github.com/jwiegley/use-package/issues/881
| -rw-r--r-- | lisp/use-package/use-package-core.el | 11 | ||||
| -rw-r--r-- | test/lisp/use-package/use-package-tests.el | 20 |
2 files changed, 23 insertions, 8 deletions
diff --git a/lisp/use-package/use-package-core.el b/lisp/use-package/use-package-core.el index cd5b907a0b0..c44c36f77fd 100644 --- a/lisp/use-package/use-package-core.el +++ b/lisp/use-package/use-package-core.el | |||
| @@ -43,6 +43,11 @@ | |||
| 43 | (require 'cl-lib) | 43 | (require 'cl-lib) |
| 44 | (require 'tabulated-list) | 44 | (require 'tabulated-list) |
| 45 | 45 | ||
| 46 | ;; Declare a synthetic theme for :custom variables. | ||
| 47 | ;; Necessary in order to avoid having those variables saved by custom.el. | ||
| 48 | (deftheme use-package) | ||
| 49 | (enable-theme 'use-package) | ||
| 50 | |||
| 46 | (if (and (eq emacs-major-version 24) (eq emacs-minor-version 3)) | 51 | (if (and (eq emacs-major-version 24) (eq emacs-minor-version 3)) |
| 47 | (defsubst hash-table-keys (hash-table) | 52 | (defsubst hash-table-keys (hash-table) |
| 48 | "Return a list of keys in HASH-TABLE." | 53 | "Return a list of keys in HASH-TABLE." |
| @@ -1394,9 +1399,9 @@ no keyword implies `:all'." | |||
| 1394 | (comment (nth 2 def))) | 1399 | (comment (nth 2 def))) |
| 1395 | (unless (and comment (stringp comment)) | 1400 | (unless (and comment (stringp comment)) |
| 1396 | (setq comment (format "Customized with use-package %s" name))) | 1401 | (setq comment (format "Customized with use-package %s" name))) |
| 1397 | `(funcall (or (get (quote ,variable) 'custom-set) #'set-default) | 1402 | `(let ((custom--inhibit-theme-enable nil)) |
| 1398 | (quote ,variable) | 1403 | (custom-theme-set-variables 'use-package |
| 1399 | ,value))) | 1404 | '(,variable ,value nil () ,comment))))) |
| 1400 | args) | 1405 | args) |
| 1401 | (use-package-process-keywords name rest state))) | 1406 | (use-package-process-keywords name rest state))) |
| 1402 | 1407 | ||
diff --git a/test/lisp/use-package/use-package-tests.el b/test/lisp/use-package/use-package-tests.el index 42bf07453b4..a68491cfb7b 100644 --- a/test/lisp/use-package/use-package-tests.el +++ b/test/lisp/use-package/use-package-tests.el | |||
| @@ -1129,15 +1129,25 @@ | |||
| 1129 | ;; '((foo bar baz)))) | 1129 | ;; '((foo bar baz)))) |
| 1130 | )) | 1130 | )) |
| 1131 | 1131 | ||
| 1132 | |||
| 1132 | (ert-deftest use-package-test/:custom-1 () | 1133 | (ert-deftest use-package-test/:custom-1 () |
| 1133 | (match-expansion | 1134 | (match-expansion |
| 1134 | (use-package foo :custom (foo bar)) | 1135 | (use-package foo :custom (foo bar)) |
| 1135 | `(progn | 1136 | `(progn |
| 1136 | (funcall | 1137 | (let |
| 1137 | (or | 1138 | ((custom--inhibit-theme-enable nil)) |
| 1138 | (get 'foo 'custom-set) | 1139 | (custom-theme-set-variables 'use-package |
| 1139 | (function set-default)) | 1140 | '(foo bar nil nil "Customized with use-package foo"))) |
| 1140 | 'foo bar) | 1141 | (require 'foo nil nil)))) |
| 1142 | |||
| 1143 | (ert-deftest use-package-test/:custom-with-comment1 () | ||
| 1144 | (match-expansion | ||
| 1145 | (use-package foo :custom (foo bar "commented")) | ||
| 1146 | `(progn | ||
| 1147 | (let | ||
| 1148 | ((custom--inhibit-theme-enable nil)) | ||
| 1149 | (custom-theme-set-variables 'use-package | ||
| 1150 | '(foo bar nil nil "commented"))) | ||
| 1141 | (require 'foo nil nil)))) | 1151 | (require 'foo nil nil)))) |
| 1142 | 1152 | ||
| 1143 | (ert-deftest use-package-test/:custom-face-1 () | 1153 | (ert-deftest use-package-test/:custom-face-1 () |