Subject: bug#79106: [PATCH] Add new optional keywords to use-package

From: Philip Kaludercic <[email-masked]>
Date: Mon, 28 Jul 2025 19:22:50 +0000

Elijah Gabe Pérez <[email-masked]> writes:

I guess it would be good to discuss the content of the patch now that we
are considering to merge it.

> Tags: patch
>
> As discussed in
> https://lists.gnu.org/archive/html/emacs-devel/2025-07/msg00354.html
>
> This patch add new optional keywords to use-package, most of them are
> inspired by suggestions from use-package bug-tracker on github
>
> This includes following keywords:
>
> * :advice Add or remove function advices.

I did not understand how this uses :advice to create something
use-package specific that has an advantage over `define-advice'.

> * :custom-face* Like :custom-face but override the face specs.
>   This closes bug#77928 dilemma.
>
> * :defvar-keymap Define a new keymap or override an existent one.

Why is this something that a user would be interested in when
configuring a package?

> * :doc Document the use-package declaration instead using comments.
>
> * :tag Like :doc, but for categorizing.
>   (This and :doc does nothing)

Can you explain what these tags are good for?

> * :emacs<, :emacs<=, :emacs=, :emacs>, :emacs>=, shorthand for
>   `:if (version...)`
>
> * :hook-suffix Changes `use-package-hook-name-suffix' value only in the
>   current use-package declaration.
>
> * :hook+ Like default :hook, but allows to set the hook depth and set
>   multiple functions in the hook (or for each hook).
>
>   Although I tried to make it compatible with :hook, there may be some
>   things I missed, so I decided to put it separately instead of merging
>   it with :hook.  In addition, its syntax is more complex compared to
>   :hook.

I can imagine that the name is confusing to beginners, and also question
if it might be cleaner to just advise users to use `add-hook' if they
want to do something specific and more technical.

> * :local-set Bind variables locally when entering to a mode or to a hook(s).
>   An alternative to  `:hook (hook . (lambda () (setq-local ...)))`
>
> * :setopt Like :custom, but can also bind plain variables.
>   This uses the `setopt` function for bind the variables.

Would it make sense to re-use :custom but modify the behaviour with a
user-option?

> * :which-key-replacement A simple way to set which-key replacements.

Wrt. the patch, I would still merge the files into one, instead of
having each keyword in a separate file.