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: Re: kill-new discards current X selection Date: Wed, 26 Aug 2009 16:39:25 -0400 Message-ID: <1f77704b0908261339y2baac531j11c6b230c28f1fd6@mail.gmail.com> References: <4A95606A.6050606@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1251319185 27603 80.91.229.12 (26 Aug 2009 20:39:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 26 Aug 2009 20:39:45 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Aug 26 22:39:38 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 1MgPHN-0000O5-Se for ged-emacs-devel@m.gmane.org; Wed, 26 Aug 2009 22:39:38 +0200 Original-Received: from localhost ([127.0.0.1]:44001 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MgPHN-0004Wm-9q for ged-emacs-devel@m.gmane.org; Wed, 26 Aug 2009 16:39:37 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MgPHI-0004Wf-MF for emacs-devel@gnu.org; Wed, 26 Aug 2009 16:39:32 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MgPHD-0004WT-8i for emacs-devel@gnu.org; Wed, 26 Aug 2009 16:39:31 -0400 Original-Received: from [199.232.76.173] (port=43129 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MgPHD-0004WQ-3e for emacs-devel@gnu.org; Wed, 26 Aug 2009 16:39:27 -0400 Original-Received: from mail-iw0-f185.google.com ([209.85.223.185]:33865) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MgPHC-0000Um-Lx for emacs-devel@gnu.org; Wed, 26 Aug 2009 16:39:26 -0400 Original-Received: by iwn15 with SMTP id 15so364866iwn.14 for ; Wed, 26 Aug 2009 13:39:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=FIjgZI4apS8I+/a9KDayveM7zZNKn5BVMZO/pf7lnTw=; b=ssNWIk7ynbyBxpj/eCaSUSAWX5zd0HaQSaEQTzVx3vczkK3FC9QDdAiXCp7ua54Hlu c/Dwx446kX+RyhLcVw/wjnGS3Op3PlPhba7v7Gtak9kR3mfaWLgpfr4cM4T/NS4Fo8sC f7q+0zk6Xnv0n76UOD62ZF+1lwrkqiL7STaGc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=Qw2QsgsYyRVL9McpUT3UDwfmETj19oz9dxQzJPa8fdCtSqFxFAz2iY6g/JbNwgyyOl mn6s7D08dz0J6c5/mMeagWz18n1wev4yyRg/tmqKhmElGC7hxdmALwFLMtz9u39Cs1tp qnx9VmwQ9Jif6VMKpBZ/hQzMhQE1La/5cLPzI= Original-Received: by 10.231.19.77 with SMTP id z13mr4791768iba.49.1251319165717; Wed, 26 Aug 2009 13:39:25 -0700 (PDT) In-Reply-To: X-Google-Sender-Auth: 2e59630e9c7ebfdd X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) 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:114636 Archived-At: On Wed, Aug 26, 2009 at 3:28 PM, Stefan Monnier w= rote: >> When I select a word in an xterm and then kill in emacs, then X selectio= n 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? > > It needs to be guarded, because it can cause a delay in C-k (when the > previous selection owner is non-responsive) and some people find it > unacceptable. =C2=A0At least that's my recollection of the consensus last > time I suggested it. OK, I will. > BTW, here's the version I use in my own local collection of hacks. > > =3D=3D=3D modified file 'lisp/simple.el' > --- lisp/simple.el =C2=A0 =C2=A0 =C2=A02009-08-19 08:31:59 +0000 > +++ lisp/simple.el =C2=A0 =C2=A0 =C2=A02009-08-21 14:24:38 +0000 > @@ -2799,6 +2851,21 @@ > =C2=A0argument is not used by `insert-for-yank'. =C2=A0However, since Lis= p code > =C2=A0may access and use elements from the kill ring directly, the STRING > =C2=A0argument should still be a \"useful\" string for such uses." > + =C2=A0;; To better pretend that X-selection =3D head-of-kill-ring, we c= opy other > + =C2=A0;; application's X-selection to the kill-ring. =C2=A0This comes i= n handy when > + =C2=A0;; you do something like: > + =C2=A0;; - copy a piece of text in your web-browser. > + =C2=A0;; - have to do some editing (including killing) before you can y= ank > + =C2=A0;; =C2=A0 that text. > + =C2=A0;; Note: this piece of code inspired from current-kill. > + =C2=A0(let ((paste (and interprogram-paste-function > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(f= uncall interprogram-paste-function)))) > + =C2=A0 =C2=A0(when paste > + =C2=A0 =C2=A0 =C2=A0(let ((interprogram-cut-function nil) > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(interprogram-paste-function n= il)) > + =C2=A0 =C2=A0 =C2=A0 =C2=A0(kill-new paste)))) I think my version is just a little bit more transparent. > + =C2=A0;; The actual kill-new functionality. > + =C2=A0(when (equal string (car kill-ring)) (setq replace t)) this seems to be a separate nice feature, similar to bash HISTCONTROL=3Dignoredups. I think it would be a good separate addition, controlled by kill-ignore-duplicates --=20 Sam Steingold