From 16563e32d18c3d1518ae3f9a32598dd976fceb05 Mon Sep 17 00:00:00 2001 From: Magnar Sveen Date: Fri, 10 Aug 2012 21:27:02 +0200 Subject: [PATCH] Add hooks when mc-mode is enabled and disabled. They are named `multiple-cursors-mode-enabled-hook` and `multiple-cursors-mode-disabled-hook`. Fixes #6 --- multiple-cursors-core.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/multiple-cursors-core.el b/multiple-cursors-core.el index 6e9de90..421c146 100644 --- a/multiple-cursors-core.el +++ b/multiple-cursors-core.el @@ -276,9 +276,12 @@ multiple cursors editing.") "Mode while multiple cursors are active." nil " mc" mc/keymap (if multiple-cursors-mode - (add-hook 'post-command-hook 'mc/execute-this-command-for-all-cursors t t) + (progn + (add-hook 'post-command-hook 'mc/execute-this-command-for-all-cursors t t) + (run-hooks 'multiple-cursors-mode-enabled-hook)) (remove-hook 'post-command-hook 'mc/execute-this-command-for-all-cursors t) - (mc/remove-fake-cursors))) + (mc/remove-fake-cursors) + (run-hooks 'multiple-cursors-mode-disabled-hook))) (add-hook 'after-revert-hook #'(lambda () (multiple-cursors-mode 0)))