From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Sam Steingold Newsgroups: gmane.emacs.devel Subject: kill-new discards current X selection Date: Wed, 26 Aug 2009 12:18:50 -0400 Message-ID: <4A95606A.6050606@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1251304926 10406 80.91.229.12 (26 Aug 2009 16:42:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 26 Aug 2009 16:42:06 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Aug 26 18:42:00 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MgLZP-0004eN-O8 for ged-emacs-devel@m.gmane.org; Wed, 26 Aug 2009 18:42:00 +0200 Original-Received: from localhost ([127.0.0.1]:38547 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MgLZP-0003RP-2c for ged-emacs-devel@m.gmane.org; Wed, 26 Aug 2009 12:41:59 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MgLDW-00035I-VT for emacs-devel@gnu.org; Wed, 26 Aug 2009 12:19:23 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MgLDS-00032C-6A for emacs-devel@gnu.org; Wed, 26 Aug 2009 12:19:22 -0400 Original-Received: from [199.232.76.173] (port=60505 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MgLDR-000324-Vm for emacs-devel@gnu.org; Wed, 26 Aug 2009 12:19:18 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:51792) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MgLDR-00044z-Fg for emacs-devel@gnu.org; Wed, 26 Aug 2009 12:19:17 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.50) id 1MgLDP-0005bu-ND for emacs-devel@gnu.org; Wed, 26 Aug 2009 18:19:15 +0200 Original-Received: from 38.105.200.250 ([38.105.200.250]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 26 Aug 2009 18:19:15 +0200 Original-Received: from sds by 38.105.200.250 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 26 Aug 2009 18:19:15 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 24 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 38.105.200.250 User-Agent: Thunderbird 2.0.0.22 (X11/20090625) X-Enigmail-Version: 0.95.6 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:114621 Archived-At: 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)