diff --git a/core/prelude-editor.el b/core/prelude-editor.el index bc00316..b685d10 100644 --- a/core/prelude-editor.el +++ b/core/prelude-editor.el @@ -290,6 +290,16 @@ (if (<= (- end beg) prelude-yank-indent-threshold) (indent-region beg end nil))) +(defmacro advise-commands (advice-name commands class &rest body) + "Apply advice named ADVICE-NAME to multiple COMMANDS. + +The body of the advice is in BODY." + `(progn + ,@(mapcar (lambda (command) + `(defadvice ,command (,class ,(intern (concat (symbol-name command) "-" advice-name)) activate) + ,@body)) + commands))) + (advise-commands "indent" (yank yank-pop) after "If current mode is one of `prelude-yank-indent-modes', indent yanked text (with prefix arg don't indent)."