Add undefadvice! macro for rotate-text convenience
This commit is contained in:
parent
7a348f8784
commit
5929e5b75a
2 changed files with 19 additions and 0 deletions
|
@ -424,5 +424,23 @@ DOCSTRING and BODY are as in `defun'.
|
|||
(dolist (target (cdr targets))
|
||||
(advice-add target (car targets) #',symbol))))))
|
||||
|
||||
(defmacro undefadvice! (symbol _arglist &optional docstring &rest body)
|
||||
"Undefine an advice called SYMBOL.
|
||||
|
||||
This has the same signature as `defadvice!' an exists as an easy undefiner when
|
||||
testing advice (when combined with `rotate-text').
|
||||
|
||||
\(fn SYMBOL ARGLIST &optional DOCSTRING &rest [WHERE PLACES...] BODY\)"
|
||||
(declare (doc-string 3) (indent defun))
|
||||
(let (where-alist)
|
||||
(unless (stringp docstring)
|
||||
(push docstring body))
|
||||
(while (keywordp (car body))
|
||||
(push `(cons ,(pop body) (doom-enlist ,(pop body)))
|
||||
where-alist))
|
||||
`(dolist (targets (list ,@(nreverse where-alist)))
|
||||
(dolist (target (cdr targets))
|
||||
(advice-remove target #',symbol)))))
|
||||
|
||||
(provide 'core-lib)
|
||||
;;; core-lib.el ends here
|
||||
|
|
|
@ -31,6 +31,7 @@ This marks a foldable marker for `outline-minor-mode' in elisp buffers.")
|
|||
("let" "let*")
|
||||
("when" "unless")
|
||||
("advice-add" "advice-remove")
|
||||
("defadvice!" "undefadvice!")
|
||||
("add-hook" "remove-hook")
|
||||
("add-hook!" "remove-hook!")
|
||||
("it" "xit")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue