Subject: bug#59941: closed (Re: use-package-defaults type not updated for added keywords :pin, :ensure etc)

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 11 Dec 2022 16:11:02 +0000

Your bug report

#59941: use-package-defaults type not updated for added keywords :pin, :ensure etc

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
59941: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=59941
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: use-package-defaults type not updated for added keywords :pin, :ensure etc
From: Mattias Engdegård <[email-masked]>
To: [email-masked]
Cc: John Wiegley <[email-masked]>, Stefan Kangas <[email-masked]>
Date: Sun, 11 Dec 2022 17:10:47 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

A simple fix has been pushed to emacs-29 (4893a15631) -- closing.

Subject: use-package-defaults type not updated for added keywords :pin, :ensure etc
From: Mattias Engdegård <[email-masked]>
To: Emacs Bug Report <[email-masked]>
Cc: John Wiegley <[email-masked]>, Stefan Kangas <[email-masked]>
Date: Sat, 10 Dec 2022 11:41:42 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

The type of `use-package-defaults` does not include the keywords :pin and :ensure, since these are added to `use-package-keywords` after the declaration of the former.

As a consequence these keywords cannot occur in `use-package-defaults` when using the interactive customisation interface, and since they are present in the default value, the `test-custom-opts` test fails with a type mismatch:

variable: use-package-defaults
   value: ((:config '(t) t) (:init nil t) (:catch t (lambda (name args) (not use-package-expand-minimally))) (:defer use-package-always-defer (lambda (name args) (and use-package-always-defer (not (plist-member args :defer)) (not (plist-member args :demand))))) (:demand use-package-always-demand (lambda (name args) (and use-package-always-demand (not (plist-member args :defer)) (not (plist-member args :demand))))) (:ensure (list use-package-always-ensure) (lambda (name args) (and use-package-always-ensure (not (plist-member args :load-path))))) (:pin use-package-always-pin use-package-always-pin))
    type: (repeat (list (choice :tag "Keyword" (const :disabled) (const :load-path) (const :requires) (const :defines) (const :functions) (const :preface) (const :if) (const :when) (const :unless) (const :no-require) (const :catch) (const :after) (const :custom) (const :custom-face) (const :bind) (const :bind*) (const :bind-keymap) (const :bind-keymap*) (const :interpreter) (const :mode) (const :magic) (const :magic-fallback) (const :hook) (const :commands) (const :autoload) (const :init) (const :defer) (const :demand) (const :load) (const :config)) (choice :tag "Default value" sexp function) (choice :tag "Enable if non-nil" sexp function)))

There are various ways to fix this. Easiest is probably to cease pretending that :pin and :ensure are somehow special and just include them in `use-package-keywords` from the start instead of adding them afterwards.

Alternatives include making the defcustom type less specific and allow any keyword, or modifying that type after adding keywords (a bit messy).