diff options
| author | Basil L. Contovounesios | 2018-04-13 12:47:30 +0100 |
|---|---|---|
| committer | Noam Postavsky | 2018-04-14 01:20:03 -0400 |
| commit | 2825d849451be45ea738e2d2b2567c834fe5a0fb (patch) | |
| tree | 53743c2e4d44ab4ba46e3383fc05e6fd55e09093 | |
| parent | 0263216ec39d0914f17b662a3e45b4163ab6cc78 (diff) | |
| download | emacs-2825d849451be45ea738e2d2b2567c834fe5a0fb.tar.gz emacs-2825d849451be45ea738e2d2b2567c834fe5a0fb.zip | |
Do not destructively modify interprogram paste
* simple.el (kill-new, current-kill): Non-destructively reverse list
returned by interprogram-paste-function. (bug#31097)
| -rw-r--r-- | lisp/simple.el | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index efe5406bf70..dada65d4ee3 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -4369,7 +4369,8 @@ argument should still be a \"useful\" string for such uses." | |||
| 4369 | (funcall interprogram-paste-function)))) | 4369 | (funcall interprogram-paste-function)))) |
| 4370 | (when interprogram-paste | 4370 | (when interprogram-paste |
| 4371 | (dolist (s (if (listp interprogram-paste) | 4371 | (dolist (s (if (listp interprogram-paste) |
| 4372 | (nreverse interprogram-paste) | 4372 | ;; Use `reverse' to avoid modifying external data. |
| 4373 | (reverse interprogram-paste) | ||
| 4373 | (list interprogram-paste))) | 4374 | (list interprogram-paste))) |
| 4374 | (unless (and kill-do-not-save-duplicates | 4375 | (unless (and kill-do-not-save-duplicates |
| 4375 | (equal-including-properties s (car kill-ring))) | 4376 | (equal-including-properties s (car kill-ring))) |
| @@ -4448,7 +4449,8 @@ move the yanking point; just return the Nth kill forward." | |||
| 4448 | ;; selection, with identical text. | 4449 | ;; selection, with identical text. |
| 4449 | (let ((interprogram-cut-function nil)) | 4450 | (let ((interprogram-cut-function nil)) |
| 4450 | (if (listp interprogram-paste) | 4451 | (if (listp interprogram-paste) |
| 4451 | (mapc 'kill-new (nreverse interprogram-paste)) | 4452 | ;; Use `reverse' to avoid modifying external data. |
| 4453 | (mapc #'kill-new (reverse interprogram-paste)) | ||
| 4452 | (kill-new interprogram-paste))) | 4454 | (kill-new interprogram-paste))) |
| 4453 | (car kill-ring)) | 4455 | (car kill-ring)) |
| 4454 | (or kill-ring (error "Kill ring is empty")) | 4456 | (or kill-ring (error "Kill ring is empty")) |