From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andreas Politz Newsgroups: gmane.emacs.help Subject: Re: Adding clipboard content to the kill ring automatically (Windows) Date: Sun, 13 Sep 2009 20:33:24 +0200 Message-ID: <878wgi3daj.fsf@fh-trier.de> References: <83k502zrki.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1252866858 1014 80.91.229.12 (13 Sep 2009 18:34:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 13 Sep 2009 18:34:18 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Sep 13 20:34:10 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Mmttq-0000MI-2C for geh-help-gnu-emacs@m.gmane.org; Sun, 13 Sep 2009 20:34:10 +0200 Original-Received: from localhost ([127.0.0.1]:56023 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mmttp-0007Cc-C2 for geh-help-gnu-emacs@m.gmane.org; Sun, 13 Sep 2009 14:34:09 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MmttR-0007Bo-OY for help-gnu-emacs@gnu.org; Sun, 13 Sep 2009 14:33:45 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MmttN-0007AG-0R for help-gnu-emacs@gnu.org; Sun, 13 Sep 2009 14:33:45 -0400 Original-Received: from [199.232.76.173] (port=40795 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MmttM-0007A9-Nd for help-gnu-emacs@gnu.org; Sun, 13 Sep 2009 14:33:40 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:44284) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MmttM-00070R-62 for help-gnu-emacs@gnu.org; Sun, 13 Sep 2009 14:33:40 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.50) id 1MmttK-0000Fg-IH for help-gnu-emacs@gnu.org; Sun, 13 Sep 2009 20:33:38 +0200 Original-Received: from dslb-084-059-196-193.pools.arcor-ip.net ([84.59.196.193]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 13 Sep 2009 20:33:38 +0200 Original-Received: from politza by dslb-084-059-196-193.pools.arcor-ip.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 13 Sep 2009 20:33:38 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 40 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: dslb-084-059-196-193.pools.arcor-ip.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:ryhjJUSX+Ac9p5OHf9mCFPA14/k= X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) 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:68118 Archived-At: PT writes: > Eli Zaretskii gnu.org> writes: >> >> Yes, set x-select-enable-clipboard to nil, while you edit and don't >> want to clobber what's in the clipboard. Then re-set it to t after >> you are done editing. >> > > Okay, by automatically I meant some method which doesn't require manual > intervention. > > Manually I can yank clipboard first, undo it, this way it gets to > the kill-ring, then do some other killings and finally retrieve > clipboard text from the kill ring with M-y > > The point is I want some automatic solution like running an idle timer > every second or so which checks if there is new text on the clipboard > and if so then adds it to the kill ring. This is sort of a brute force > solution, having a constantly running timer, that's why I asked if there > is a more intelligent automatic solution for the problem than that. I use something like the following, when I need to grab a couple of links in some browser. I don't know know, if that works on w32 and it is likely going to destroy any non-text clipboard content. (defun kill-clipboard-fn (type) (kill-new (x-get-selection)) (x-set-selection nil (x-get-selection))) (define-minor-mode auto-kill-clipboard nil nil nil nil :global t (if (not auto-kill-clipboard) (remove-hook 'x-lost-selection-functions 'kill-clipboard-fn) (x-set-selection nil (x-get-selection)) (add-hook 'x-lost-selection-functions 'kill-clipboard-fn))) -ap