[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

kill-new discards current X selection

From: Sam Steingold
Subject: kill-new discards current X selection
Date: Wed, 26 Aug 2009 12:18:50 -0400
User-agent: Thunderbird (X11/20090625)

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)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]