unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Sam Steingold <sds@gnu.org>
To: emacs-devel@gnu.org
Subject: kill-new discards current X selection
Date: Wed, 26 Aug 2009 12:18:50 -0400	[thread overview]
Message-ID: <4A95606A.6050606@gnu.org> (raw)

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	other threads:[~2009-08-26 16:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-26 16:18 Sam Steingold [this message]
2009-08-26 18:41 ` kill-new discards current X selection 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A95606A.6050606@gnu.org \
    --to=sds@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).