[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 2825d84 1/2: Do not destructively modify interprogr
From: |
Noam Postavsky |
Subject: |
[Emacs-diffs] master 2825d84 1/2: Do not destructively modify interprogram paste |
Date: |
Sat, 14 Apr 2018 02:07:27 -0400 (EDT) |
branch: master
commit 2825d849451be45ea738e2d2b2567c834fe5a0fb
Author: Basil L. Contovounesios <address@hidden>
Commit: Noam Postavsky <address@hidden>
Do not destructively modify interprogram paste
* simple.el (kill-new, current-kill): Non-destructively reverse list
returned by interprogram-paste-function. (bug#31097)
---
lisp/simple.el | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lisp/simple.el b/lisp/simple.el
index efe5406..dada65d 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -4369,7 +4369,8 @@ argument should still be a \"useful\" string for such
uses."
(funcall interprogram-paste-function))))
(when interprogram-paste
(dolist (s (if (listp interprogram-paste)
- (nreverse interprogram-paste)
+ ;; Use `reverse' to avoid modifying external data.
+ (reverse interprogram-paste)
(list interprogram-paste)))
(unless (and kill-do-not-save-duplicates
(equal-including-properties s (car kill-ring)))
@@ -4448,7 +4449,8 @@ move the yanking point; just return the Nth kill forward."
;; selection, with identical text.
(let ((interprogram-cut-function nil))
(if (listp interprogram-paste)
- (mapc 'kill-new (nreverse interprogram-paste))
+ ;; Use `reverse' to avoid modifying external data.
+ (mapc #'kill-new (reverse interprogram-paste))
(kill-new interprogram-paste)))
(car kill-ring))
(or kill-ring (error "Kill ring is empty"))