all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Yank from system clipboard?
@ 2010-08-05 10:25 Elena
  2010-08-05 11:18 ` Marc Mientki
  2010-08-05 13:15 ` Elena
  0 siblings, 2 replies; 6+ messages in thread
From: Elena @ 2010-08-05 10:25 UTC (permalink / raw)
  To: help-gnu-emacs

Hello,

how do you non-interactively yank only the content of the system
clipboard, even when it's empty?

`clipboard-yank', whenever the system clipboard is empty, yanks the
last kill instead (at least on Windows).

Thanks.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Yank from system clipboard?
  2010-08-05 10:25 Yank from system clipboard? Elena
@ 2010-08-05 11:18 ` Marc Mientki
  2010-08-05 11:36   ` Elena
  2010-08-05 13:15 ` Elena
  1 sibling, 1 reply; 6+ messages in thread
From: Marc Mientki @ 2010-08-05 11:18 UTC (permalink / raw)
  To: help-gnu-emacs

Am 05.08.2010 12:25, schrieb Elena:
> Hello,
>
> how do you non-interactively yank only the content of the system
> clipboard, even when it's empty?
>
> `clipboard-yank', whenever the system clipboard is empty, yanks the
> last kill instead (at least on Windows).

Try with (current-kill 0).

HTH
Marc



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Yank from system clipboard?
  2010-08-05 11:18 ` Marc Mientki
@ 2010-08-05 11:36   ` Elena
  2010-08-05 15:00     ` Marc Mientki
  0 siblings, 1 reply; 6+ messages in thread
From: Elena @ 2010-08-05 11:36 UTC (permalink / raw)
  To: help-gnu-emacs

Thanks for answering.

I've not understood the docs about `(current-kill 0)', however I've
tried:

(current-kill 0)
(clipboard-yank)

and Emacs still yanks the last kill.

What I'm missing?


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Yank from system clipboard?
  2010-08-05 10:25 Yank from system clipboard? Elena
  2010-08-05 11:18 ` Marc Mientki
@ 2010-08-05 13:15 ` Elena
  1 sibling, 0 replies; 6+ messages in thread
From: Elena @ 2010-08-05 13:15 UTC (permalink / raw)
  To: help-gnu-emacs

I've tried:

(insert (x-get-clipboard))

without success. I guess `x-get-clipboard' does not work on Windows.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Yank from system clipboard?
  2010-08-05 11:36   ` Elena
@ 2010-08-05 15:00     ` Marc Mientki
  2010-08-05 15:49       ` Elena
  0 siblings, 1 reply; 6+ messages in thread
From: Marc Mientki @ 2010-08-05 15:00 UTC (permalink / raw)
  To: help-gnu-emacs

Am 05.08.2010 13:36, schrieb Elena:
> Thanks for answering.
>
> I've not understood the docs about `(current-kill 0)', however I've
> tried:
>
> (current-kill 0)
> (clipboard-yank)
>
> and Emacs still yanks the last kill.
>
> What I'm missing?

I have probably not understand the task. What you want to do? Mark 
something outside of Emacs, copy (CTRL-C) and yank (paste) it in
Emacs buffer? But what means "non-interactively yank".

The (current-kill 0) puts content of system clipboard into Emacs
kill-ring and (clipboard-yank) puts this into buffer, or you can
access to this text via kill-ring variable with (car kill-ring).
Or (substring-no-properties (car kill-ring)) or directly
(substring-no-properties (current-kill 0)) - in case you don't want
text properties.

regards
Marc




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Yank from system clipboard?
  2010-08-05 15:00     ` Marc Mientki
@ 2010-08-05 15:49       ` Elena
  0 siblings, 0 replies; 6+ messages in thread
From: Elena @ 2010-08-05 15:49 UTC (permalink / raw)
  To: help-gnu-emacs

On Aug 5, 3:00 pm, Marc Mientki <mien...@nonet.com> wrote:
> I have probably not understand the task. What you want to do? Mark
> something outside of Emacs, copy (CTRL-C) and yank (paste) it in
> Emacs buffer? But what means "non-interactively yank".

I want to select text outside of Emacs and then, by means of Emacs
client, I want to tell Emacs to grab it and insert it into a buffer.
Since it's throw-away text, I don't want to mess with files, so I have
thought the clipboard would do. However, selected text could also be
empty, that is, the clipboard will be empty. And here I'm stuck,
because whenever the clipboard is empty, (clipboard-yank) yanks the
last kill. (current-kill 0) does not change this (at least here: Emacs
23.1.1 + Windows XP).

Wait! I've thought about a workaround: telling Emacs beforehand
whether the clipboard is empty or not.

However, I'm still curious about why Emacs doesn't allow me to access
the system clipboard directly.

Thanks for your attention.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-08-05 15:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-05 10:25 Yank from system clipboard? Elena
2010-08-05 11:18 ` Marc Mientki
2010-08-05 11:36   ` Elena
2010-08-05 15:00     ` Marc Mientki
2010-08-05 15:49       ` Elena
2010-08-05 13:15 ` Elena

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.