unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Andreas Politz <politza@fh-trier.de>
To: help-gnu-emacs@gnu.org
Subject: Re: Adding clipboard content to the kill ring automatically	(Windows)
Date: Sun, 13 Sep 2009 20:33:24 +0200	[thread overview]
Message-ID: <878wgi3daj.fsf@fh-trier.de> (raw)
In-Reply-To: loom.20090913T194141-129@post.gmane.org

PT <spamfilteraccount@gmail.com> writes:

> Eli Zaretskii <eliz <at> 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





  reply	other threads:[~2009-09-13 18:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-13 16:59 Adding clipboard content to the kill ring automatically (Windows) PT
2009-09-13 17:23 ` Eli Zaretskii
2009-09-13 17:48   ` PT
2009-09-13 18:33     ` Andreas Politz [this message]
2009-09-13 19:27       ` PT
2009-09-13 23:01 ` Jeff Clough
2009-09-14  4:48   ` PT
2009-09-14  6:05     ` PT
     [not found]     ` <mailman.6633.1252908378.2239.help-gnu-emacs@gnu.org>
2009-09-23 16:29       ` bigfaceworm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878wgi3daj.fsf@fh-trier.de \
    --to=politza@fh-trier.de \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).