summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2023-03-23 07:57:18 -0700
committerSean Whitton <spwhitton@spwhitton.name>2023-03-23 07:57:18 -0700
commite99ebb68c21890ec7d26ac447b44645cfb61b1ec (patch)
treec19478a45b97be0d5b8d70cd9a77ef05f8dda71d
parent88978c39ac6076ac912ba6d95b61d3c50f1d422a (diff)
downloaddotfiles-e99ebb68c21890ec7d26ac447b44645cfb61b1ec.tar.gz
spw/add-once-hook: use letrec
-rw-r--r--.emacs.d/init.el10
1 files 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)