From ff9602ef7540c8835f089bb52c7a77ecdba9bfcb Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sun, 2 Oct 2022 19:08:53 +0200 Subject: [PATCH] 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: a4b58311dace Fix: #6865 --- lisp/doom-lib.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/doom-lib.el b/lisp/doom-lib.el index 2e5724ccd..473f52edd 100644 --- a/lisp/doom-lib.el +++ b/lisp/doom-lib.el @@ -749,8 +749,9 @@ advised)." (defun ,fn (&rest _) ,(format "Transient hook for %S" (doom-unquote hook-or-function)) ,@forms - (cond ((functionp sym) (advice-remove sym #',fn)) - ((symbolp sym) (remove-hook sym #',fn))) + (let ((sym ,hook-or-function)) + (cond ((functionp sym) (advice-remove sym #',fn)) + ((symbolp sym) (remove-hook sym #',fn)))) (unintern ',fn nil)) (cond ((functionp sym) (advice-add ,hook-or-function ,(if append? :after :before) #',fn))