fix(lib): revert add-transient-hook! refactor

a4b5831 removed this let-binding because I expected the function to
capture it, which seems to be the case in general, except for #6865.
Since add-transient-hook! could conceivably be used in an elisp file
with lexical-binding off, I'll take fewer chances and live with a little
redundancy.

Amend: a4b58311da
Fix: #6865
This commit is contained in:
Henrik Lissner 2022-10-02 19:08:53 +02:00
parent 6eab48641f
commit ff9602ef75
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -749,8 +749,9 @@ advised)."
(defun ,fn (&rest _)
,(format "Transient hook for %S" (doom-unquote hook-or-function))
,@forms
(let ((sym ,hook-or-function))
(cond ((functionp sym) (advice-remove sym #',fn))
((symbolp sym) (remove-hook sym #',fn)))
((symbolp sym) (remove-hook sym #',fn))))
(unintern ',fn nil))
(cond ((functionp sym)
(advice-add ,hook-or-function ,(if append? :after :before) #',fn))