Subject: Re: bug#77928: [PATCH] use-package :custom-face is meant to behave like custom-set-face

From: Eli Zaretskii <[email-masked]>
Date: Sat, 26 Apr 2025 15:52:32 +0300

> From: Michael Shields <[email-masked]>
> Date: Sat, 19 Apr 2025 13:41:01 -0700
> 
> The attached patch fixes a bug where migrating a face spec from custom.el to use-package :custom-face
> results in a surprising behavior change: the new spec is overlaid on the default value instead of replacing it.
> This seems to have been an unintended consequence of
> https://github.com/jwiegley/use-package/issues/934.

Thanks.

I wanted to install this, but it causes failures in the tests: the 3
that you amended and the new 4th one, see the details below.  Could
you please fix that?

Also, please include the followup change for the documentation in the
next patch submittal, and also please observe our conventions for log
messages.  In particular, too long lines there are rejected by our
git-commit-hooks.  Please also mention the bug number in the commit
log message.

Here are the errors from the tests:

  Test use-package-test/:custom-face-1 backtrace:
    signal(ert-test-failed (((should (pcase (expand-minimally (use-packa
    ert-fail(((should (pcase (expand-minimally (use-package foo :custom-
    (if (unwind-protect (setq value-665 (let* ((val (let (... ...) (macr
    (let (form-description-666) (if (unwind-protect (setq value-665 (let
    (let ((value-665 (gensym "ert-form-evaluation-aborted-"))) (let (for
    #f(lambda () [t] (let ((value-665 (gensym "ert-form-evaluation-abort
    #f(compiled-function () #<bytecode -0x17069ad950ffacee>)()
    handler-bind-1(#f(compiled-function () #<bytecode -0x17069ad950fface
    ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
    ert-run-test(#s(ert-test :name use-package-test/:custom-face-1 :docu
    ert-run-or-rerun-test(#s(ert--stats :selector ... :tests ... :test-m
    ert-run-tests((not (or (tag :unstable) (tag :nativecomp))) #f(compil
    ert-run-tests-batch((not (or (tag :unstable) (tag :nativecomp))))
    ert-run-tests-batch-and-exit((not (or (tag :unstable) (tag :nativeco
    eval((ert-run-tests-batch-and-exit '(not (or (tag :unstable) (tag :n
    command-line-1(("-L" ";." "-l" "ert" "--eval" "(setq treesit-extra-l
    command-line()
    normal-top-level()
  Test use-package-test/:custom-face-1 condition:
      (ert-test-failed
       ((should (pcase (expand-minimally ...) (... t))) :form
	(let* ((val ...)) (if (equal val ...) (let nil t))) :value nil))
     FAILED   71/167  use-package-test/:custom-face-1 (0.000224 sec) at lisp/use-package/use-package-tests.el:1152
  Test use-package-test/:custom-face-2 backtrace:
    signal(ert-test-failed (((should (pcase (expand-minimally (use-packa
    ert-fail(((should (pcase (expand-minimally (use-package example :cus
    (if (unwind-protect (setq value-667 (let* ((val (let (... ...) (macr
    (let (form-description-668) (if (unwind-protect (setq value-667 (let
    (let ((value-667 (gensym "ert-form-evaluation-aborted-"))) (let (for
    #f(lambda () [t] (let ((value-667 (gensym "ert-form-evaluation-abort
    #f(compiled-function () #<bytecode -0x17069ad950ffacee>)()
    handler-bind-1(#f(compiled-function () #<bytecode -0x17069ad950fface
    ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
    ert-run-test(#s(ert-test :name use-package-test/:custom-face-2 :docu
    ert-run-or-rerun-test(#s(ert--stats :selector ... :tests ... :test-m
    ert-run-tests((not (or (tag :unstable) (tag :nativecomp))) #f(compil
    ert-run-tests-batch((not (or (tag :unstable) (tag :nativecomp))))
    ert-run-tests-batch-and-exit((not (or (tag :unstable) (tag :nativeco
    eval((ert-run-tests-batch-and-exit '(not (or (tag :unstable) (tag :n
    command-line-1(("-L" ";." "-l" "ert" "--eval" "(setq treesit-extra-l
    command-line()
    normal-top-level()
  Test use-package-test/:custom-face-2 condition:
      (ert-test-failed
       ((should (pcase (expand-minimally ...) (... t))) :form
	(let* ((val ...)) (if (equal val ...) (let nil t))) :value nil))
     FAILED   72/167  use-package-test/:custom-face-2 (0.000323 sec) at lisp/use-package/use-package-tests.el:1164
  Test use-package-test/:custom-face-3 backtrace:
    signal(ert-test-failed (((should (pcase (expand-minimally (use-packa
    ert-fail(((should (pcase (expand-minimally (use-package foo :custom-
    (if (unwind-protect (setq value-669 (let* ((val (let (... ...) (macr
    (let (form-description-670) (if (unwind-protect (setq value-669 (let
    (let ((value-669 (gensym "ert-form-evaluation-aborted-"))) (let (for
    #f(lambda () [t] (let ((value-669 (gensym "ert-form-evaluation-abort
    #f(compiled-function () #<bytecode -0x17069ad950ffacee>)()
    handler-bind-1(#f(compiled-function () #<bytecode -0x17069ad950fface
    ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
    ert-run-test(#s(ert-test :name use-package-test/:custom-face-3 :docu
    ert-run-or-rerun-test(#s(ert--stats :selector ... :tests ... :test-m
    ert-run-tests((not (or (tag :unstable) (tag :nativecomp))) #f(compil
    ert-run-tests-batch((not (or (tag :unstable) (tag :nativecomp))))
    ert-run-tests-batch-and-exit((not (or (tag :unstable) (tag :nativeco
    eval((ert-run-tests-batch-and-exit '(not (or (tag :unstable) (tag :n
    command-line-1(("-L" ";." "-l" "ert" "--eval" "(setq treesit-extra-l
    command-line()
    normal-top-level()
  Test use-package-test/:custom-face-3 condition:
      (ert-test-failed
       ((should (pcase (expand-minimally ...) (... t))) :form
	(let* ((val ...)) (if (equal val ...) (let nil t))) :value nil))
     FAILED   73/167  use-package-test/:custom-face-3 (0.000269 sec) at lisp/use-package/use-package-tests.el:1183
  Test use-package-test/:custom-face-4 backtrace:
    signal(ert-test-failed (((should (equal (face-background 'use-packag
    ert-fail(((should (equal (face-background 'use-package-test/face nil
    (if (unwind-protect (setq value-678 (apply fn-676 args-677)) (setq f
    (let (form-description-680) (if (unwind-protect (setq value-678 (app
    (let ((value-678 'ert-form-evaluation-aborted-679)) (let (form-descr
    (let* ((fn-676 #'equal) (args-677 (condition-case err (list (face-ba
    #f(lambda () [t] (custom-declare-face 'use-package-test/base-face '(
    #f(compiled-function () #<bytecode -0x17069ad950ffacee>)()
    handler-bind-1(#f(compiled-function () #<bytecode -0x17069ad950fface
    ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
    ert-run-test(#s(ert-test :name use-package-test/:custom-face-4 :docu
    ert-run-or-rerun-test(#s(ert--stats :selector ... :tests ... :test-m
    ert-run-tests((not (or (tag :unstable) (tag :nativecomp))) #f(compil
    ert-run-tests-batch((not (or (tag :unstable) (tag :nativecomp))))
    ert-run-tests-batch-and-exit((not (or (tag :unstable) (tag :nativeco
    eval((ert-run-tests-batch-and-exit '(not (or (tag :unstable) (tag :n
    command-line-1(("-L" ";." "-l" "ert" "--eval" "(setq treesit-extra-l
    command-line()
    normal-top-level()
  Test use-package-test/:custom-face-4 condition:
      (ert-test-failed
       ((should (equal (face-background ... nil t) nil)) :form
	(equal "green" nil) :value nil :explanation
	(different-types "green" nil)))
     FAILED   74/167  use-package-test/:custom-face-4 (0.000288 sec) at lisp/use-package/use-package-tests.el:1194