From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "David De La Harpe Golden" Newsgroups: gmane.emacs.devel Subject: Re: Improving X selection? Date: Wed, 17 Oct 2007 02:05:45 +0100 Message-ID: <8e24944a0710161805j652b883ap7fc87cc5ea87d5@mail.gmail.com> References: <8e24944a0710161629r1ec1afadj60352dc92c264217@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1192583173 21880 80.91.229.12 (17 Oct 2007 01:06:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 17 Oct 2007 01:06:13 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 17 03:06:13 2007 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 1IhxMS-0004wU-Ah for ged-emacs-devel@m.gmane.org; Wed, 17 Oct 2007 03:06:12 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IhxML-0005xk-Cl for ged-emacs-devel@m.gmane.org; Tue, 16 Oct 2007 21:06:05 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IhxM3-0005bx-Ri for emacs-devel@gnu.org; Tue, 16 Oct 2007 21:05:47 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IhxM3-0005bT-8K for emacs-devel@gnu.org; Tue, 16 Oct 2007 21:05:47 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IhxM2-0005b5-Uy for emacs-devel@gnu.org; Tue, 16 Oct 2007 21:05:47 -0400 Original-Received: from wr-out-0506.google.com ([64.233.184.224]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IhxM2-0004TY-PG for emacs-devel@gnu.org; Tue, 16 Oct 2007 21:05:46 -0400 Original-Received: by wr-out-0506.google.com with SMTP id 50so1231762wra for ; Tue, 16 Oct 2007 18:05:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=c37eN+T7sHvsQQOpnIWDkpyOrwfWkiKsEh+JoSV8pSQ=; b=uGbpndWh46t2Y+QgMaETHlM26ZtVvfmVP8GkDwG4PLuEsXUVuhxQQ/qwo5dBOs5KqWhzbj4vC3hijfVNj7oOb+E3TsNgdf+BuIrv8mNG8t7TZ4rymjDKIRARQV2NdhJVwZLCGDzlrKOB28BtWCtI3jAQt+kIPGhjhp3BO4ymLBI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=gsgMwweAEYymHQhZHcKNxSq6NaLBgxhmOHkUTsGRHPj4aTmWYUHQU87s5ZDGakOdsfdCpksF8y3x9xxtS03HsYwyUiHR/8bwlZfq+u2d/57MZcrEEueDIuCCBTLPb1pC3CGYPo2SPP9SJdcqOd/U7yNmTprqmMpj+lIMXchbU1c= Original-Received: by 10.142.111.14 with SMTP id j14mr2379256wfc.1192583145118; Tue, 16 Oct 2007 18:05:45 -0700 (PDT) Original-Received: by 10.142.163.7 with HTTP; Tue, 16 Oct 2007 18:05:45 -0700 (PDT) In-Reply-To: <8e24944a0710161629r1ec1afadj60352dc92c264217@mail.gmail.com> Content-Disposition: inline X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 (Google crawlbot) 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:81033 Archived-At: If you've done the stuff in my previous mail, another IMHO useful change (that I use but I didn't include in the previous mail because it is a little more confusing if you don't expect it) is to make current-kill propagate its return back out via interprogram-cut-function if N > zero, and do-not-move is nil, and interprogram-cut-function is set. Then, emacs acts a bit like a clipboard history manager or pigeonholes - you can cut/copy in another X11 application A, C-y into emacs, cut/copy in another X11 application B, C-y into emacs, (etc... ). Then, in emacs cycle between the various cuts now in the emacs kill ring with M-y, then when you find the right one, it can be pasted back into an external X11 application directly since it's already in CLIPBOARD (assuming previous mail). Not too different in end result to just copying to a scratch buffer from the various apps and then selectively copying back out from it, but hey. e.g. ; based on simple.el/current-kill (defun current-kill (n &optional do-not-move) "Rotate the yanking point by N places, and then return that kill. If N is zero, `interprogram-paste-function' is set, and calling it returns a string, then that string is added to the front of the kill ring and returned as the latest kill. If N > zero, `interprogram-cut-function' is set, and do-not-move is nil, then also call the `interprogram-cut-function' with the latest kill - i.e. propagate it back out to the host environment clipboard. If optional arg DO-NOT-MOVE is non-nil, then don't actually move the yanking point; just return the Nth kill forward." (let ((interprogram-paste (and (= n 0) interprogram-paste-function (funcall interprogram-paste-function)))) (if interprogram-paste (progn ;; Disable the interprogram cut function when we add the new ;; text to the kill ring, so Emacs doesn't try to own the ;; selection, with identical text. (let ((interprogram-cut-function nil)) (kill-new interprogram-paste)) interprogram-paste) (or kill-ring (error "Kill ring is empty")) (let ((ARGth-kill-element (nthcdr (mod (- n (length kill-ring-yank-pointer)) (length kill-ring)) kill-ring))) (unless do-not-move (setq kill-ring-yank-pointer ARGth-kill-element) (when (and (> n 0) interprogram-cut-function) (funcall interprogram-cut-function (car ARGth-kill-element)))) (car ARGth-kill-element)))))