[Fix #1194] Restore the advise-commands macro

I didn't notice that it had other usages in the code when I deleted
it in the commit introducing super-save.
This commit is contained in:
Bozhidar Batsov 2018-09-28 18:41:39 +03:00
parent c139f01f9b
commit 6811b60486

View file

@ -290,6 +290,16 @@
(if (<= (- end beg) prelude-yank-indent-threshold) (if (<= (- end beg) prelude-yank-indent-threshold)
(indent-region beg end nil))) (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 (advise-commands "indent" (yank yank-pop) after
"If current mode is one of `prelude-yank-indent-modes', "If current mode is one of `prelude-yank-indent-modes',
indent yanked text (with prefix arg don't indent)." indent yanked text (with prefix arg don't indent)."