]> git.eshelyaron.com Git - emacs.git/commitdiff
Allow passing the SPEC-TYPE argument via :custom-face
authorAndrey Listopadov <andreyorst@gmail.com>
Sat, 29 Oct 2022 10:24:13 +0000 (13:24 +0300)
committerAndrey Listopadov <andreyorst@gmail.com>
Sat, 29 Oct 2022 10:26:31 +0000 (13:26 +0300)
GitHub-reference: https://github.com/jwiegley/use-package/issues/1008
Copyright-paperwork-exempt: yes

lisp/use-package/use-package-core.el
lisp/use-package/use-package.el
test/lisp/use-package/use-package-tests.el

index f27d158fc056c5baa732f58738d575027d974271..135b1ca96b09cb011d7ad9a1ae708fb3ae7f35ab 100644 (file)
@@ -1501,7 +1501,7 @@ no keyword implies `:all'."
 (defun use-package-normalize/:custom-face (name-symbol _keyword arg)
   "Normalize use-package custom-face keyword."
   (let ((error-msg
-         (format "%s wants a (<symbol> <face-spec>) or list of these"
+         (format "%s wants a (<symbol> <face-spec> [spec-type]) or list of these"
                  name-symbol)))
     (unless (listp arg)
       (use-package-error error-msg))
@@ -1512,7 +1512,7 @@ no keyword implies `:all'."
             (spec (nth 1 def)))
         (when (or (not face)
                   (not spec)
-                  (> (length def) 2))
+                  (> (length def) 3))
           (use-package-error error-msg))))))
 
 (defun use-package-handler/:custom-face (name _keyword args rest state)
index 574431d80b5604624f3fab14469b1252b9f2359d..240693c1189587c7fa1fa950d4bb7cec4c57cba7 100644 (file)
@@ -6,7 +6,7 @@
 ;; Maintainer: John Wiegley <johnw@newartisans.com>
 ;; Created: 17 Jun 2012
 ;; Modified: 29 Nov 2017
-;; Version: 2.4.2
+;; Version: 2.4.3
 ;; Package-Requires: ((emacs "24.3") (bind-key "2.4"))
 ;; Keywords: dotemacs startup speed config package
 ;; URL: https://github.com/jwiegley/use-package
index 7d98ca99e4ac3f5812157f8f3e0963aaadc06dde..185f7691ba92c995530ef06d60bec7a048c53ffb 100644 (file)
              (backquote (example-2-face ((t (:foreground "LightGreen"))))))
       (require 'example nil nil))))
 
+(ert-deftest use-package-test/:custom-face-3 ()
+  (match-expansion
+   (use-package foo :custom-face (foo ((t (:background "#e4edfc"))) face-defspec-spec))
+   `(progn
+      (apply #'face-spec-set (backquote (foo ((t (:background "#e4edfc"))) face-defspec-spec)))
+      (require 'foo nil nil))))
+
 (ert-deftest use-package-test/:init-1 ()
   (match-expansion
    (use-package foo :init (init))