[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Saving the selection before killing
From: |
David Kastrup |
Subject: |
Re: Saving the selection before killing |
Date: |
Thu, 12 Jul 2007 22:45:44 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux) |
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>> From: Will <schimpanski@gmx.de>
>>> Newsgroups: gnu.emacs.help
>>> Date: Thu, 12 Jul 2007 14:14:01 +0200
>>>
>>> I'd like to copy text from external applications (e.g. web
>>> browser) to an Emacs buffer. Often before I paste the text into an
>>> Emacs buffer I'd like to delete text in the this buffer _without_
>>> it being copied to the kill-ring, because then the text from the
>>> external application gets lost.
>
> I bump into the OP's problem every once in a while, but I don't like
> delete-selection-mode for some reason, so I use the patch below
> instead. What it does is that when you kill text, before doing the
> kill (which will replace the current X-selection with the killed
> text), we save the current selection on the kill-ring (only if it
> doesn't come from us, of course since otherwise it's already in the
> kill-ring). So I can simply do my kill and then C-y (which
> re-inserts what I just killed) and M-y (which replaces the text with
> the previous X-selection).
>
> This feature is pretty unnoticeable, so I'm tempted to install it
> just like that, but maybe people want yet-another-config-var to
> control it?
The problem I see is that it is pretty unnoticeable iff the size of
the selection is small compared to the network bandwidth. It would be
nicest if Emacs could tell the X server "if someone asks for a
selection, tell me, and then I'll tell you whether I'll hand over a
selection, or whether you can ask the one who has it now for it."
I don't know the X protocols to know whether this is feasible with
regard to the network traffic. It might be infeasible due to
program's expectations about the kill ring, anyway.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum