summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)