Skip to content

Commit

Permalink
tweak(core): accept hook symbol in +hook-once!
Browse files Browse the repository at this point in the history
  • Loading branch information
abougouffa committed Apr 18, 2023
1 parent 4dd3285 commit 4a08072
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion elisp/+minemacs.el
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,8 @@ DEPTH and LOCAL are passed as is to `add-hook'."
(defmacro +hook-once! (hook &rest body)
"Hook BODY in HOOK, it runs only once."
(declare (indent 1))
(let ((fn-name (intern (format "+hook-once--function-%d-h" (cl-incf +hook-once-num)))))
(let ((hook (+unquote hook))
(fn-name (intern (format "+hook-once--function-%d-h" (cl-incf +hook-once-num)))))
`(add-hook
',hook
(defun ,fn-name ()
Expand Down

0 comments on commit 4a08072

Please sign in to comment.