> From: John Wiegley <jo...@gnu.org>
> Cc: Marc Fargas <teleni...@telenieko.com>,  72...@debbugs.gnu.org
> Date: Mon, 26 Aug 2024 11:47:25 -0700
> 
> >>>>> Eli Zaretskii <e...@gnu.org> writes:
> 
> > Maybe I'm missing something, but how can use-package configure
> > abnormal hooks?  It doesn't know which arguments to pass to them,
> > right?
> >
> > John, am I missing something?
> 
> I think the behavior should be that if the variable name exists at the time
> the use-package macro is encountered, it should use it directly. Only if the
> named hook variable has no ‘symbol-value’ — at that time — should it try
> appending the name ‘-hook‘ to find a place to append the function.
> 
> I.e., the definition could be:
> 
> (defun use-package-handler/:hook (name _keyword args rest state)
>   "Generate use-package custom keyword code."
>   (use-package-concat
>    (use-package-process-keywords name rest state)
>    (cl-mapcan
>     #'(lambda (def)
>         (let ((syms (car def))
>               (fun (cdr def)))
>           (when fun
>             (mapcar
>              #'(lambda (sym)
>                  (if (boundp sym)
>                      `(add-hook (quote ,sym) (function ,fun))
>                    `(add-hook
>                      (quote ,(intern
>                               (concat (symbol-name sym)
>                                       use-package-hook-name-suffix)))
>                      (function ,fun))))
>              (use-package-hook-handler-normalize-mode-symbols syms)))))
>     (use-package-normalize-commands args))))

Thanks, installed on the emacs-30 release branch, and closing the bug.



Reply via email to