From 76a5ce5d8693cf7e8a70209b4275e0c21708e4a9 Mon Sep 17 00:00:00 2001 From: Andrey Listopadov Date: Sat, 29 Oct 2022 13:24:13 +0300 Subject: [PATCH] Allow passing the SPEC-TYPE argument via :custom-face GitHub-reference: https://github.com/jwiegley/use-package/issues/1008 Copyright-paperwork-exempt: yes --- lisp/use-package/use-package-core.el | 4 ++-- lisp/use-package/use-package.el | 2 +- test/lisp/use-package/use-package-tests.el | 7 +++++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lisp/use-package/use-package-core.el b/lisp/use-package/use-package-core.el index f27d158fc05..135b1ca96b0 100644 --- a/lisp/use-package/use-package-core.el +++ b/lisp/use-package/use-package-core.el @@ -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 ( ) or list of these" + (format "%s wants a ( [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) diff --git a/lisp/use-package/use-package.el b/lisp/use-package/use-package.el index 574431d80b5..240693c1189 100644 --- a/lisp/use-package/use-package.el +++ b/lisp/use-package/use-package.el @@ -6,7 +6,7 @@ ;; Maintainer: John Wiegley ;; 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 diff --git a/test/lisp/use-package/use-package-tests.el b/test/lisp/use-package/use-package-tests.el index 7d98ca99e4a..185f7691ba9 100644 --- a/test/lisp/use-package/use-package-tests.el +++ b/test/lisp/use-package/use-package-tests.el @@ -1172,6 +1172,13 @@ (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)) -- 2.39.2