unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* kill-new discards current X selection
@ 2009-08-26 16:18 Sam Steingold
  2009-08-26 18:41 ` Jan D.
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Sam Steingold @ 2009-08-26 16:18 UTC (permalink / raw)
  To: emacs-devel

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)





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-08-27  3:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-26 16:18 kill-new discards current X selection Sam Steingold
2009-08-26 18:41 ` Jan D.
2009-08-26 19:28 ` Stefan Monnier
2009-08-26 20:39   ` Sam Steingold
2009-08-27  3:03     ` Stefan Monnier
2009-08-26 19:36 ` David De La Harpe Golden

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).