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 azzamsa committed Sep 29, 2018
1 parent ec2a2e0 commit 969327d
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 @@ -293,6 +293,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 969327d

Please sign in to comment.