When I select a word in an xterm and then kill in emacs, then X
selection is gone forever, replaced with the emacs kill.
The appended patch prepends the current X selection to kill-ring
before replacing the X selection with the current Emacs kill.
Is it OK to install it unconditionally, or is it better to guard it
with a user option, e.g., save-interprogram-paste-before-kill?
--- simple.el.~1.1005.~ 2009-08-25 16:44:36.000000000 -0400
+++ simple.el 2009-08-26 12:15:19.000123000 -0400
@@ -2819,6 +2819,13 @@ argument should still be a \"useful\" st
(list string "yank-handler specified for empty string"))))
(if (fboundp 'menu-bar-update-yank-menu)
(menu-bar-update-yank-menu string (and replace (car kill-
ring))))
+ (let ((interprogram-paste (and interprogram-paste-function
+ (funcall interprogram-paste-function))))
+ (when interprogram-paste
+ (if (listp interprogram-paste)
+ (dolist (s (nreverse interprogram-paste))
+ (push s kill-ring))
+ (push interprogram-paste kill-ring))))
(if (and replace kill-ring)
(setcar kill-ring string)
(push string kill-ring)