diff --git a/evil-commands.el b/evil-commands.el index 5dbda830..cf92cf60 100644 --- a/evil-commands.el +++ b/evil-commands.el @@ -1652,7 +1652,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)) @@ -1722,7 +1722,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) @@ -1747,7 +1747,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)))))) @@ -1804,7 +1804,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) @@ -2206,7 +2207,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 @@ -2220,7 +2221,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 @@ -2257,7 +2258,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)) @@ -2310,7 +2310,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 @@ -2398,7 +2397,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 @@ -2912,7 +2911,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 () @@ -3402,7 +3401,7 @@ If no FILE is specified, reload the current buffer from disk as read-only." (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 '("#" "%")) @@ -3410,11 +3409,11 @@ If no FILE is specified, reload the current buffer from disk as read-only." (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 aaeb8e1b..49954b27 100644 --- a/evil-common.el +++ b/evil-common.el @@ -1806,7 +1806,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))) @@ -1815,7 +1815,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 @@ -2420,7 +2420,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) @@ -2430,8 +2430,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))) @@ -2440,7 +2440,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." @@ -2459,7 +2459,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 @@ -2474,12 +2474,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 75727ef3..5a2333c6 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)