diff --git a/layers/+misc/multiple-cursors/funcs.el b/layers/+misc/multiple-cursors/funcs.el index f9d937424dc2..807c6ee7045f 100644 --- a/layers/+misc/multiple-cursors/funcs.el +++ b/layers/+misc/multiple-cursors/funcs.el @@ -19,7 +19,7 @@ (defun spacemacs/evil-mc-paste-after (&optional count register) "Disable paste transient state if there is more than 1 cursor." - (interactive "p") + (interactive "*P") (setq this-command 'evil-paste-after) (if (spacemacs//evil-mc-paste-transient-state-p) (spacemacs/paste-transient-state/evil-paste-after) @@ -27,7 +27,7 @@ (defun spacemacs/evil-mc-paste-before (&optional count register) "Disable paste transient state if there is more than 1 cursor." - (interactive "p") + (interactive "*P") (setq this-command 'evil-paste-before) (if (spacemacs//evil-mc-paste-transient-state-p) (spacemacs/paste-transient-state/evil-paste-before) diff --git a/layers/+spacemacs/spacemacs-defaults/funcs.el b/layers/+spacemacs/spacemacs-defaults/funcs.el index 16cde4a82edb..fc12b9623de1 100644 --- a/layers/+spacemacs/spacemacs-defaults/funcs.el +++ b/layers/+spacemacs/spacemacs-defaults/funcs.el @@ -1294,21 +1294,25 @@ Compare them on count first,and in case of tie sort them alphabetically." (if (<= (- end beg) spacemacs-yank-indent-threshold) (indent-region beg end nil))) -(spacemacs|advise-commands - "indent" (yank yank-pop evil-paste-before evil-paste-after) around - "If current mode is not one of spacemacs-indent-sensitive-modes - indent yanked text (with universal arg don't indent)." - (evil-start-undo-step) - ad-do-it - (if (and (not (equal '(4) (ad-get-arg 0))) - (not (member major-mode spacemacs-indent-sensitive-modes)) - (or (derived-mode-p 'prog-mode) - (member major-mode spacemacs-indent-sensitive-modes))) - (let ((transient-mark-mode nil) - (save-undo buffer-undo-list)) - (spacemacs/yank-advised-indent-function (region-beginning) - (region-end)))) - (evil-end-undo-step)) +(defun spacemacs//yank-indent-region (yank-func &rest args) + "If current mode is not one of spacemacs-indent-sensitive-modes +indent yanked text (with universal arg don't indent)." + (evil-start-undo-step) + (let ((prefix (car args))) + (setcar args (unless (equal '(4) prefix) prefix)) + (apply yank-func args) + (if (and (not (equal '(4) prefix)) + (not (member major-mode spacemacs-indent-sensitive-modes)) + (or (derived-mode-p 'prog-mode) + (member major-mode spacemacs-indent-sensitive-modes))) + (let ((transient-mark-mode nil) + (save-undo buffer-undo-list)) + (spacemacs/yank-advised-indent-function (region-beginning) + (region-end))))) + (evil-end-undo-step)) + +(dolist (func '(yank yank-pop evil-paste-before evil-paste-after)) + (advice-add func :around #'spacemacs//yank-indent-region)) ;; find file functions in split (defun spacemacs//display-in-split (buffer alist) diff --git a/layers/+spacemacs/spacemacs-evil/funcs.el b/layers/+spacemacs/spacemacs-evil/funcs.el index fa4e654dbc1a..456468ef7102 100644 --- a/layers/+spacemacs/spacemacs-evil/funcs.el +++ b/layers/+spacemacs/spacemacs-evil/funcs.el @@ -61,14 +61,14 @@ Otherwise, revert to the default behavior (i.e. enable `evil-insert-state')." (evil-escape-mode t) (evil-escape-mode -1))) - + (defun spacemacs/linum-relative-toggle () (interactive) (if (not (bound-and-true-p linum-relative-mode)) (linum-mode)) (linum-relative-toggle)) - + ;; vi-tilde-fringe (defun spacemacs/disable-vi-tilde-fringe () @@ -80,7 +80,7 @@ Otherwise, revert to the default behavior (i.e. enable `evil-insert-state')." (when buffer-read-only (spacemacs/disable-vi-tilde-fringe))) - + ;; lisp state (defun spacemacs//load-evil-lisp-state ()