aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasilij Schneidermann <mail@vasilij.de>2017-06-19 07:49:43 +0200
committerEivind Fonn <evfonn@gmail.com>2017-06-22 10:24:49 +0200
commit76700a90d127fbd6eb6cd4ff7cb04fc6b8f64aa3 (patch)
treee410610b0fb837c3eee65055c72bc066e321e9a8
parentf371f2c6fdd57a939502f5032a8d93cd71493d0d (diff)
Keep Emacs from clearing text properties on yank
This should be safe to do as Evil already does this with the pasted text. Closes #855
-rw-r--r--evil-common.el6
-rw-r--r--evil-tests.el14
2 files changed, 17 insertions, 3 deletions
diff --git a/evil-common.el b/evil-common.el
index 501b9e7..53a840f 100644
--- a/evil-common.el
+++ b/evil-common.el
@@ -2430,7 +2430,9 @@ The tracked insertion is set to `evil-last-insertion'."
"Saves the lines in the region BEG and END into the kill-ring."
(let* ((text (filter-buffer-substring beg end))
(yank-handler (list (or yank-handler
- #'evil-yank-line-handler))))
+ #'evil-yank-line-handler)
+ nil
+ t)))
;; Ensure the text ends with a newline. This is required
;; if the deleted lines were the last lines in the buffer.
(when (or (zerop (length text))
@@ -2457,7 +2459,7 @@ The tracked insertion is set to `evil-last-insertion'."
(let* ((yank-handler (list (or yank-handler
#'evil-yank-block-handler)
lines
- nil
+ t
'evil-delete-yanked-rectangle))
(text (propertize (mapconcat #'identity lines "\n")
'yank-handler yank-handler)))
diff --git a/evil-tests.el b/evil-tests.el
index fb509ac..de5ca12 100644
--- a/evil-tests.el
+++ b/evil-tests.el
@@ -2676,7 +2676,19 @@ This bufferThis bufferThis buffe[r];; and for Lisp evaluation."))
("p")
";; This buffer is for notes you don't want to save.;;
;; If you want to create a file, visit that file wi;; th C-x C-f,
-;; then enter the text in that file's own buffer. ;;")))
+;; then enter the text in that file's own buffer. ;;"))
+ (ert-info ("Paste preserves preceding text properties")
+ (evil-test-buffer
+ "[;]; This buffer is for notes you don't want to save.
+;; If you want to create a file, visit that file with C-x C-f,
+;; then enter the text in that file's own buffer."
+ (put-text-property (point) (line-end-position) 'font-lock-face 'warning)
+ ("yyp")
+ ";; This buffer is for notes you don't want to save.
+[;]; This buffer is for notes you don't want to save.
+;; If you want to create a file, visit that file with C-x C-f,
+;; then enter the text in that file's own buffer."
+ (should (equal (get-text-property (point-min) 'font-lock-face) 'warning)))))
(ert-deftest evil-test-paste-pop-before ()
"Test `evil-paste-pop' after `evil-paste-before'"