refactor: minor refactors & nit picks across core

This commit is contained in:
Henrik Lissner 2021-10-09 19:55:47 +02:00
parent 432ca05c4f
commit f5c1332a31
6 changed files with 41 additions and 43 deletions

View file

@ -564,7 +564,6 @@ reverse this and trigger `after!' blocks at a more reasonable time."
;;; Hooks
(defvar doom--transient-counter 0)
(defmacro add-transient-hook! (hook-or-function &rest forms)
"Attaches a self-removing function to HOOK-OR-FUNCTION.
@ -577,7 +576,10 @@ advised)."
(let ((append (if (eq (car forms) :after) (pop forms)))
;; Avoid `make-symbol' and `gensym' here because an interned symbol is
;; easier to debug in backtraces (and is visible to `describe-function')
(fn (intern (format "doom--transient-%d-h" (cl-incf doom--transient-counter)))))
(fn (intern (format "doom--transient-%d-h"
(put 'add-transient-hook! 'counter
(1+ (or (get 'add-transient-hook! 'counter)
0)))))))
`(let ((sym ,hook-or-function))
(defun ,fn (&rest _)
,(format "Transient hook for %S" (doom-unquote hook-or-function))