From f319034c5afa9421e11578fc738258627de67f43 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 4 May 2018 15:06:05 +0200 Subject: [PATCH] feature/evil: refactor multiple-cursors compat config --- modules/feature/evil/config.el | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/modules/feature/evil/config.el b/modules/feature/evil/config.el index a2a3f77db..ec5c19b37 100644 --- a/modules/feature/evil/config.el +++ b/modules/feature/evil/config.el @@ -434,22 +434,22 @@ the new algorithm is confusing, like in python or ruby." (setq +evil--mc-compat-evil-prev-state nil) (setq +evil--mc-compat-mark-was-active nil)))) - (add-hook 'multiple-cursors-mode-enabled-hook '+evil|mc-compat-switch-to-emacs-state) - (add-hook 'multiple-cursors-mode-disabled-hook '+evil|mc-compat-back-to-previous-state) + (add-hook 'multiple-cursors-mode-enabled-hook #'+evil|mc-compat-switch-to-emacs-state) + (add-hook 'multiple-cursors-mode-disabled-hook #'+evil|mc-compat-back-to-previous-state) + + ;; When running edit-lines, point will return (position + 1) as a + ;; result of how evil deals with regions + (defun +evil*mc/edit-lines (&rest _) + (when (+evil--visual-or-normal-p) + (if (> (point) (mark)) + (goto-char (1- (point))) + (push-mark (1- (mark)))))) + (advice-add #'mc/edit-lines :before #'+evil*mc/edit-lines) (defun +evil|mc-evil-compat-rect-switch-state () (if rectangular-region-mode (+evil|mc-compat-switch-to-emacs-state) (setq +evil--mc-compat-evil-prev-state nil))) - - ;; When running edit-lines, point will return (position + 1) as a - ;; result of how evil deals with regions - (defadvice mc/edit-lines (before change-point-by-1 activate) - (when (+evil--visual-or-normal-p) - (if (> (point) (mark)) - (goto-char (1- (point))) - (push-mark (1- (mark)))))) - (add-hook 'rectangular-region-mode-hook '+evil|mc-evil-compat-rect-switch-state) (defvar mc--default-cmds-to-run-once nil))