From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: bkhl@elektrubadur.se (=?utf-8?Q?Bj=C3=B6rn_Lindstr=C3=B6m?=) Newsgroups: gmane.emacs.help Subject: interprogram-cut/paste-functions Date: Tue, 02 Aug 2005 14:52:25 +0200 Message-ID: <87iryotsae.fsf@lucien.dreaming> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1122993731 4832 80.91.229.2 (2 Aug 2005 14:42:11 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 2 Aug 2005 14:42:11 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Aug 02 14:57:52 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DzwKQ-00056g-Mf for geh-help-gnu-emacs@m.gmane.org; Tue, 02 Aug 2005 14:57:07 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DzwN7-0004Se-9I for geh-help-gnu-emacs@m.gmane.org; Tue, 02 Aug 2005 08:59:53 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DzwMc-0004Qz-Gx for help-gnu-emacs@gnu.org; Tue, 02 Aug 2005 08:59:22 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DzwMa-0004Q9-RI for help-gnu-emacs@gnu.org; Tue, 02 Aug 2005 08:59:21 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DzwMa-0004Pm-F0 for help-gnu-emacs@gnu.org; Tue, 02 Aug 2005 08:59:20 -0400 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtp (TLS-1.0:RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1DzwVl-0003Uw-QA for help-gnu-emacs@gnu.org; Tue, 02 Aug 2005 09:08:50 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1DzwHW-0004hs-SH for help-gnu-emacs@gnu.org; Tue, 02 Aug 2005 14:54:06 +0200 Original-Received: from h238n5c1o1124.bredband.skanova.com ([81.228.156.238]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 02 Aug 2005 14:54:06 +0200 Original-Received: from bkhl by h238n5c1o1124.bredband.skanova.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 02 Aug 2005 14:54:06 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: help-gnu-emacs@gnu.org Original-To: help-gnu-emacs@gnu.org Original-Lines: 23 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: h238n5c1o1124.bredband.skanova.com Mail-Copies-To: never X-Home-Page: http://bkhl.elektrubadur.se/ User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:9g0PEBZwswbEpw1WDqD9eeCnPFw= X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:28347 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:28347 I'm trying to get my text mode Emacs session to interoperate with my X clipboard, using xsel (http://www.vergenet.net/~conrad/software/xsel/). The following sort of works, except that when I yank something in Emacs, the empty string gets pushed to kill-ring. I suspect that I misunderstand when interprogram-paste-function is supposed to return nil, but I need help figuring out how. Here's my attempt so far: (defun bkhl-cut-function (text &optional push) (with-temp-buffer (insert text) (call-process-region (point-min) (point-max) "xsel" nil 0 "--input"))) (setq interprogram-cut-function 'bkhl-cut-function) (defun bkhl-paste-function () (let ((text (with-output-to-string (with-current-buffer standard-output (call-process "xsel" nil standard-output nil "--output"))))) (unless (string= (car kill-ring) text) text))) (setq interprogram-paste-function 'bkhl-paste-function)