Skip to content

Commit

Permalink
[Fix bbatsov#1194] Restore the advise-commands macro
Browse files Browse the repository at this point in the history
I didn't notice that it had other usages in the code when I deleted
it in the commit introducing super-save.
  • Loading branch information
bbatsov authored and Caleb Epstein committed Sep 4, 2019
1 parent fff9279 commit f3f0281
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions core/prelude-editor.el
Original file line number Diff line number Diff line change
Expand Up @@ -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)."
Expand Down

0 comments on commit f3f0281

Please sign in to comment.