mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-03 12:27:26 -05:00
Add let-advice!! test macro
This commit is contained in:
@ -159,8 +159,21 @@ marker. e.g. {2} can be retrieved with (point!! 2)."
|
|||||||
marker-list)))
|
marker-list)))
|
||||||
|
|
||||||
(defmacro with-minor-mode!! (mode &rest body)
|
(defmacro with-minor-mode!! (mode &rest body)
|
||||||
"TODO"
|
"Activate a minor mode while in BODY, deactivating it after."
|
||||||
(declare (indent defun))
|
(declare (indent defun))
|
||||||
`(progn (,mode +1)
|
`(progn (,mode +1)
|
||||||
,@body
|
,@body
|
||||||
(,mode -1)))
|
(,mode -1)))
|
||||||
|
|
||||||
|
(defmacro let-advice!! (binds &rest body)
|
||||||
|
"Temporarily bind advice in BINDS while in BODY.
|
||||||
|
|
||||||
|
e.g. (old-fn :before advice-fn)
|
||||||
|
(old-fn :around advice-fn)"
|
||||||
|
(declare (indent defun))
|
||||||
|
`(progn
|
||||||
|
,@(cl-loop for (target type advice) in binds
|
||||||
|
collect `(advice-add #',target ,type #',advice))
|
||||||
|
,@body
|
||||||
|
,@(cl-loop for (target type advice) in binds
|
||||||
|
collect `(advice-remove #',target #',advice))))
|
||||||
|
Reference in New Issue
Block a user