From e99ebb68c21890ec7d26ac447b44645cfb61b1ec Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Thu, 23 Mar 2023 07:57:18 -0700 Subject: spw/add-once-hook: use letrec --- .emacs.d/init.el | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 827fd8f8..ba7d662c 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -555,11 +555,11 @@ there is nothing already typed that should be wrapped." (defmacro spw/add-once-hook (hook function &optional depth local) "Add a hook which removes itself when called. For something which should happen just once." - (let ((sym (gensym))) - `(progn (fset ',sym (lambda (&rest args) - (remove-hook ,hook ',sym ,local) - (apply ,function args))) - (add-hook ,hook ',sym ,depth ,local)))) + (let ((fun (gensym))) + `(letrec ((,fun (lambda (&rest args) + (remove-hook ,hook ,fun ,local) + (apply ,function args)))) + (add-hook ,hook ,fun ,depth ,local)))) (defconst spw/fqdn (cond ((string-prefix-p (format "%s." (system-name)) mail-host-address) -- cgit v1.2.3