diff --git a/evil-commands.el b/evil-commands.el index 286cf946..f6b632a6 100644 --- a/evil-commands.el +++ b/evil-commands.el @@ -1627,7 +1627,7 @@ given." (if force (evil-insert-newline-above) (evil-insert-newline-below)) (evil-set-marker ?\[ (point)) ;; `insert' rather than `insert-for-yank' as we want to ignore yank-handlers... - (insert (if (and (< 0 (length text)) + (insert-and-inherit (if (and (< 0 (length text)) (eq ?\n (aref text (1- (length text))))) (substring text 0 (1- (length text))) text)) @@ -1696,7 +1696,7 @@ of the block." (when (or (zerop len) (/= (aref txt (1- len)) ?\n)) (setq txt (concat txt "\n"))) (when (and (eobp) (not (bolp))) (newline)) ; incomplete last line - (insert txt) + (insert-and-inherit txt) (forward-line -1))) (evil-define-command evil-move (beg end address) @@ -1721,7 +1721,7 @@ of the block." (when (and (eobp) (not (bolp))) (newline)) ; incomplete last line (when (evil-visual-state-p) (move-marker evil-visual-mark (point))) - (insert txt) + (insert-and-inherit txt) (forward-line -1) (when (evil-visual-state-p) (move-marker evil-visual-point (point)))))) @@ -1774,7 +1774,8 @@ Add (add-hook 'evil-local-mode-hook 'turn-on-undo-tree-mode) to your init file f (let ((char (following-char))) (delete-char 1) (insert-char - (if (eq (upcase char) char) (downcase char) (upcase char)))) + (if (eq (upcase char) char) (downcase char) (upcase char)) + 1 t)) (setq beg (1+ beg)))))) (evil-define-operator evil-invert-char (beg end type) @@ -2176,7 +2177,7 @@ The default for width is the value of `fill-column'." (let ((beg (evil-move-to-column begcol nil t)) (end (evil-move-to-column endcol nil t))) (delete-region beg end) - (insert (make-string (- endcol begcol) char)))))) + (insert-and-inherit (make-string (- endcol begcol) char)))))) beg end char)) (goto-char beg) (cond @@ -2190,7 +2191,7 @@ The default for width is the value of `fill-column'." (if (eq (char-after) ?\n) (forward-char) (delete-char 1) - (insert-char char 1))) + (insert-char char 1 t))) (goto-char (max beg (1- end)))))))) (evil-define-command evil-paste-before @@ -2226,7 +2227,6 @@ The return value is the yanked text." ;; no yank-handler, default (when (vectorp text) (setq text (evil-vector-to-string text))) - (set-text-properties 0 (length text) nil text) (push-mark opoint t) (dotimes (_ (or count 1)) (insert-for-yank text)) @@ -2278,7 +2278,6 @@ The return value is the yanked text." ;; no yank-handler, default (when (vectorp text) (setq text (evil-vector-to-string text))) - (set-text-properties 0 (length text) nil text) (unless (eolp) (forward-char)) (push-mark (point) t) ;; TODO: Perhaps it is better to collect a list of all @@ -2366,7 +2365,7 @@ leave the cursor just after the new text." (when (and (eq yank-handler #'evil-yank-line-handler) (not (memq type '(line block))) (/= end (point-max))) - (insert "\n")) + (insert-and-inherit "\n")) (evil-normal-state) (when kill-ring (current-kill 1))) ;; Effectively memoize `evil-get-register' because it can be @@ -2878,7 +2877,7 @@ next VCOUNT - 1 lines below the current one." insert-prompt (make-overlay opoint (+ chars-to-delete opoint))) (evil-update-replace-alist opoint count chars-to-delete)) (setq insert-prompt (make-overlay opoint opoint))) - (insert-char (evil-read-digraph-char-with-overlay insert-prompt) count) + (insert-char (evil-read-digraph-char-with-overlay insert-prompt) count t) (when chars-to-delete (delete-char chars-to-delete)))) (evil-define-command evil-ex-show-digraphs () @@ -3349,7 +3348,7 @@ If no FILE is specified, reload the current buffer from disk." (when count (goto-char (point-min))) (when (or (not (zerop (forward-line (or count 1)))) (not (bolp))) - (insert "\n")) + (insert-and-inherit "\n")) (cond ((/= (aref file 0) ?!) (when (member file '("#" "%")) @@ -3357,11 +3356,11 @@ If no FILE is specified, reload the current buffer from disk." (let ((result (insert-file-contents file))) (save-excursion (forward-char (cadr result)) - (unless (bolp) (insert "\n"))))) + (unless (bolp) (insert-and-inherit "\n"))))) (t (shell-command (evil-ex-replace-special-filenames (substring file 1)) t) (goto-char (mark)) - (unless (bolp) (insert "\n")) + (unless (bolp) (insert-and-inherit "\n")) (forward-line -1))))) (evil-define-command evil-show-files () diff --git a/evil-common.el b/evil-common.el index c305c256..eea98b3a 100644 --- a/evil-common.el +++ b/evil-common.el @@ -1801,7 +1801,7 @@ closer if MOVE is non-nil." with regard to indentation." (evil-narrow-to-field (evil-move-beginning-of-line) - (insert (if use-hard-newlines hard-newline "\n")) + (insert-and-inherit (if use-hard-newlines hard-newline "\n")) (forward-line -1) (back-to-indentation))) @@ -1810,7 +1810,7 @@ with regard to indentation." with regard to indentation." (evil-narrow-to-field (evil-move-end-of-line) - (insert (if use-hard-newlines hard-newline "\n")) + (insert-and-inherit (if use-hard-newlines hard-newline "\n")) (back-to-indentation))) ;;; Markers @@ -2415,7 +2415,7 @@ The tracked insertion is set to `evil-last-insertion'." ((eq this-command 'evil-paste-before) (evil-move-beginning-of-line) (let ((beg (point))) - (insert text) + (insert-and-inherit text) (setq evil-last-paste (list 'evil-paste-before evil-paste-count opoint beg (point))) (evil-set-marker ?\[ beg) @@ -2425,8 +2425,8 @@ The tracked insertion is set to `evil-last-insertion'." ((eq this-command 'evil-paste-after) (evil-move-end-of-line) (let ((beg (point))) - (insert "\n") - (insert text) + (insert-and-inherit "\n") + (insert-and-inherit text) (delete-char -1) ; delete the last newline (setq evil-last-paste (list 'evil-paste-after evil-paste-count opoint beg (point))) @@ -2435,7 +2435,7 @@ The tracked insertion is set to `evil-last-insertion'." (unless evil--cursor-after (goto-char (1+ beg)))) (back-to-indentation)) - (t (insert text))))) + (t (insert-and-inherit text))))) (defun evil-yank-block-handler (lines) "Insert the current text as block." @@ -2451,7 +2451,7 @@ The tracked insertion is set to `evil-last-insertion'." (setq first nil) (when (or (> (forward-line 1) 0) (and (eobp) (not (bolp)))) - (insert "\n"))) + (insert-and-inherit "\n"))) ;; concat multiple copies according to count (setq line (apply #'concat (make-list count line))) ;; trim whitespace at beginning and end @@ -2466,12 +2466,12 @@ The tracked insertion is set to `evil-last-insertion'." (if (< (evil-column (line-end-position)) col) (move-to-column (+ col begextra) t) (move-to-column col t) - (insert (make-string begextra ?\s))) + (insert-and-inherit (make-string begextra ?\s))) (evil-remove-yank-excluded-properties text) - (insert text) + (insert-and-inherit text) (unless (eolp) ;; text follows, so we have to insert spaces - (insert (make-string endextra ?\s)))))) + (insert-and-inherit (make-string endextra ?\s)))))) (setq evil-last-paste (list this-command evil-paste-count diff --git a/evil-repeat.el b/evil-repeat.el index df00d8f6..7d1b8fe5 100644 --- a/evil-repeat.el +++ b/evil-repeat.el @@ -491,7 +491,7 @@ where point should be placed after all changes." (dolist (change changes) (goto-char (+ point (nth 0 change))) (delete-char (nth 2 change)) - (insert (nth 1 change))) + (insert-and-inherit (nth 1 change))) (goto-char (+ point rel-point))))) (defun evil-execute-repeat-info (repeat-info)