mirror of
https://github.com/masscollaborationlabs/emacs.git
synced 2025-07-05 11:49:37 +00:00
Add use-package-use-theme and avoid missing theme errors
This commit is contained in:
parent
c425e67a19
commit
2b9536f242
2 changed files with 43 additions and 12 deletions
|
@ -135,6 +135,13 @@ arguments will be ignored in the `use-package' expansion."
|
||||||
:type 'boolean
|
:type 'boolean
|
||||||
:group 'use-package)
|
:group 'use-package)
|
||||||
|
|
||||||
|
(defcustom use-package-use-theme t
|
||||||
|
"If non-nil, use a custom theme to avoid saving :custom
|
||||||
|
variables twice (once in the Custom file, once in the use-package
|
||||||
|
call)."
|
||||||
|
:type 'boolean
|
||||||
|
:group 'use-package)
|
||||||
|
|
||||||
(defcustom use-package-verbose nil
|
(defcustom use-package-verbose nil
|
||||||
"Whether to report about loading and configuration details.
|
"Whether to report about loading and configuration details.
|
||||||
If you customize this, then you should require the `use-package'
|
If you customize this, then you should require the `use-package'
|
||||||
|
@ -1397,18 +1404,34 @@ no keyword implies `:all'."
|
||||||
(defun use-package-handler/:custom (name _keyword args rest state)
|
(defun use-package-handler/:custom (name _keyword args rest state)
|
||||||
"Generate use-package custom keyword code."
|
"Generate use-package custom keyword code."
|
||||||
(use-package-concat
|
(use-package-concat
|
||||||
`((let ((custom--inhibit-theme-enable nil))
|
(if (bound-and-true-p use-package-use-theme)
|
||||||
(custom-theme-set-variables
|
`((let ((custom--inhibit-theme-enable nil))
|
||||||
'use-package
|
;; Declare the theme here so use-package can be required inside
|
||||||
,@(mapcar
|
;; eval-and-compile without warnings about unknown theme.
|
||||||
#'(lambda (def)
|
(unless (memq 'use-package custom-known-themes)
|
||||||
(let ((variable (nth 0 def))
|
(deftheme use-package)
|
||||||
(value (nth 1 def))
|
(enable-theme 'use-package)
|
||||||
(comment (nth 2 def)))
|
(setq custom-enabled-themes (remq 'use-package custom-enabled-themes)))
|
||||||
(unless (and comment (stringp comment))
|
(custom-theme-set-variables
|
||||||
(setq comment (format "Customized with use-package %s" name)))
|
'use-package
|
||||||
`'(,variable ,value nil () ,comment)))
|
,@(mapcar
|
||||||
args))))
|
#'(lambda (def)
|
||||||
|
(let ((variable (nth 0 def))
|
||||||
|
(value (nth 1 def))
|
||||||
|
(comment (nth 2 def)))
|
||||||
|
(unless (and comment (stringp comment))
|
||||||
|
(setq comment (format "Customized with use-package %s" name)))
|
||||||
|
`'(,variable ,value nil () ,comment)))
|
||||||
|
args))))
|
||||||
|
(mapcar
|
||||||
|
#'(lambda (def)
|
||||||
|
(let ((variable (nth 0 def))
|
||||||
|
(value (nth 1 def))
|
||||||
|
(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)))
|
||||||
|
args))
|
||||||
(use-package-process-keywords name rest state)))
|
(use-package-process-keywords name rest state)))
|
||||||
|
|
||||||
;;;; :custom-face
|
;;;; :custom-face
|
||||||
|
|
|
@ -1136,6 +1136,10 @@
|
||||||
`(progn
|
`(progn
|
||||||
(let
|
(let
|
||||||
((custom--inhibit-theme-enable nil))
|
((custom--inhibit-theme-enable nil))
|
||||||
|
(unless (memq 'use-package custom-known-themes)
|
||||||
|
(deftheme use-package)
|
||||||
|
(enable-theme 'use-package)
|
||||||
|
(setq custom-enabled-themes (remq 'use-package custom-enabled-themes)))
|
||||||
(custom-theme-set-variables 'use-package
|
(custom-theme-set-variables 'use-package
|
||||||
'(foo bar nil nil "Customized with use-package foo")))
|
'(foo bar nil nil "Customized with use-package foo")))
|
||||||
(require 'foo nil nil))))
|
(require 'foo nil nil))))
|
||||||
|
@ -1146,6 +1150,10 @@
|
||||||
`(progn
|
`(progn
|
||||||
(let
|
(let
|
||||||
((custom--inhibit-theme-enable nil))
|
((custom--inhibit-theme-enable nil))
|
||||||
|
(unless (memq 'use-package custom-known-themes)
|
||||||
|
(deftheme use-package)
|
||||||
|
(enable-theme 'use-package)
|
||||||
|
(setq custom-enabled-themes (remq 'use-package custom-enabled-themes)))
|
||||||
(custom-theme-set-variables 'use-package
|
(custom-theme-set-variables 'use-package
|
||||||
'(foo bar nil nil "commented")))
|
'(foo bar nil nil "commented")))
|
||||||
(require 'foo nil nil))))
|
(require 'foo nil nil))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue