unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Ctrl-Y is pasting from the clipboard
@ 2006-12-18 18:16 Dan Bensen
  2006-12-18 18:51 ` Harald Hanche-Olsen
  0 siblings, 1 reply; 9+ messages in thread
From: Dan Bensen @ 2006-12-18 18:16 UTC (permalink / raw)


Ctrl-Y never worked with the clipboard, so a couple months ago, I made a 
couple key sequences to call clipboard-yank/kill-*. It worked nicely.

Then a couple weeks ago, my new sequences started working with the 
regular Emacs kill ring.  All of a sudden, Ctrl-Y works with the X 
clipboard.  Does anybody know why that happened?

-- 
Dan
www.prairienet.org/~dsb

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

* Re: Ctrl-Y is pasting from the clipboard
  2006-12-18 18:16 Ctrl-Y is pasting from the clipboard Dan Bensen
@ 2006-12-18 18:51 ` Harald Hanche-Olsen
  2006-12-19  5:52   ` Dan Bensen
  0 siblings, 1 reply; 9+ messages in thread
From: Harald Hanche-Olsen @ 2006-12-18 18:51 UTC (permalink / raw)


+ Dan Bensen <randomgeek@cyberspace.net>:

| Ctrl-Y never worked with the clipboard, so a couple months ago, I made
| a couple key sequences to call clipboard-yank/kill-*. It worked
| nicely.
|
| Then a couple weeks ago, my new sequences started working with the
| regular Emacs kill ring.  All of a sudden, Ctrl-Y works with the X
| clipboard.  Does anybody know why that happened?

Nope.  We don't do telepathy here.

Tell us what your code looks like, and maybe we can begin to guess
what happened.

-- 
* Harald Hanche-Olsen     <URL:http://www.math.ntnu.no/~hanche/>
- It is undesirable to believe a proposition
  when there is no ground whatsoever for supposing it is true.
  -- Bertrand Russell

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

* Re: Ctrl-Y is pasting from the clipboard
  2006-12-18 18:51 ` Harald Hanche-Olsen
@ 2006-12-19  5:52   ` Dan Bensen
  2006-12-19  9:50     ` Harald Hanche-Olsen
  2006-12-19 11:16     ` Johan Bockgård
  0 siblings, 2 replies; 9+ messages in thread
From: Dan Bensen @ 2006-12-19  5:52 UTC (permalink / raw)


Harald Hanche-Olsen wrote:
> Nope.  We don't do telepathy here.
Sometimes experience and insight are adequate substitutes.

> Tell us what your code looks like, and maybe we can begin to guess
> what happened.
Here's the code in .emacs:
(global-set-key "\C-xcy" 'clipboard-yank)
(global-set-key "\C-xck" 'clipboard-kill-region)
(global-set-key "\C-xcc" 'clipboard-kill-ring-save)

I restarted both emacs and X, and it's still working.
I can copy text from Firefox or a pdf file and paste it into emacs with 
either Ctrl-y or Ctrl-x c y.  I thought the emacs kill ring was 
different from the X clipboard.  I added Ctrl-x c y|k|c because I had 
been having trouble moving text between emacs and X.

-- 
Dan
www.prairienet.org/~dsb

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

* Re: Ctrl-Y is pasting from the clipboard
  2006-12-19  5:52   ` Dan Bensen
@ 2006-12-19  9:50     ` Harald Hanche-Olsen
  2006-12-22  5:26       ` Dan Bensen
  2006-12-19 11:16     ` Johan Bockgård
  1 sibling, 1 reply; 9+ messages in thread
From: Harald Hanche-Olsen @ 2006-12-19  9:50 UTC (permalink / raw)


+ Dan Bensen <randomgeek@cyberspace.net>:

| Harald Hanche-Olsen wrote:
|> Nope.  We don't do telepathy here.
| Sometimes experience and insight are adequate substitutes.
|
|> Tell us what your code looks like, and maybe we can begin to guess
|> what happened.
| Here's the code in .emacs:
| (global-set-key "\C-xcy" 'clipboard-yank)
| (global-set-key "\C-xck" 'clipboard-kill-region)
| (global-set-key "\C-xcc" 'clipboard-kill-ring-save)
|
| I restarted both emacs and X, and it's still working.

Surely, restarting X was overkill.

| I can copy text from Firefox or a pdf file and paste it into emacs
| with either Ctrl-y or Ctrl-x c y.  I thought the emacs kill ring was
| different from the X clipboard.

Ah, now I get what you're driving at.  Yeah, they're different, but
there's magic in them thar functions.  Consider C-y, which is bound to
the command yank, defined in simple.el.  If you look at the definition
(easy: just C-h k C-y and click on the _simple_ link in the help
window) you will find that yank calls current-kill to get what it is
yanking, and current-kill in its turn will funcall
interprogram-paste-function, which is a variable that typically (on X)
has the value x-cut-buffer-or-selection-value.  And that function is
described as follows in x-win.el:

;;; Return the value of the current X selection.
;;; Consult the selection, and the cut buffer.  Treat empty strings
;;; as if they were unset.
;;; If this function is called twice and finds the same text,
;;; it returns nil the second time.  This is so that a single
;;; selection won't be added to the kill ring over and over.

In summary, if you set interprogram-paste-function to nil then I think
you have completely severed the connection between the kill ring and
the X selection, and then you will always have to make a conscious
choice between the two.  But that seems to be what you want.  Try it,
and see if it does what you want.  Heck, I may want to try it myself.

(No apology for the lengthy answer with such a brief solution.  I try
to educate people, teach them how to find answers on their own, rather
than just telling them the answer.  Occupational hazard.)

-- 
* Harald Hanche-Olsen     <URL:http://www.math.ntnu.no/~hanche/>
- It is undesirable to believe a proposition
  when there is no ground whatsoever for supposing it is true.
  -- Bertrand Russell

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

* Re: Ctrl-Y is pasting from the clipboard
  2006-12-19  5:52   ` Dan Bensen
  2006-12-19  9:50     ` Harald Hanche-Olsen
@ 2006-12-19 11:16     ` Johan Bockgård
  2006-12-22  5:37       ` Dan Bensen
  1 sibling, 1 reply; 9+ messages in thread
From: Johan Bockgård @ 2006-12-19 11:16 UTC (permalink / raw)


Dan Bensen <randomgeek@cyberspace.net> writes:

> I thought the emacs kill ring was different from the X clipboard.

(info "(emacs)Clipboard")  <-- C-x C-e

-- 
Johan Bockgård

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

* Re: Ctrl-Y is pasting from the clipboard
  2006-12-19  9:50     ` Harald Hanche-Olsen
@ 2006-12-22  5:26       ` Dan Bensen
  0 siblings, 0 replies; 9+ messages in thread
From: Dan Bensen @ 2006-12-22  5:26 UTC (permalink / raw)


> | I can copy text from Firefox or a pdf file and paste it into emacs
> | with either Ctrl-y or Ctrl-x c y.  I thought the emacs kill ring was
> | different from the X clipboard.

Harald Hanche-Olsen wrote:
> window) you will find that yank calls current-kill to get what it is
> yanking, and current-kill in its turn will funcall
> interprogram-paste-function, which is a variable that typically (on X)
> has the value x-cut-buffer-or-selection-value.  And that function is
> described as follows in x-win.el:
> ;;; Return the value of the current X selection.

> In summary, if you set interprogram-paste-function to nil then I think
> you have completely severed the connection between the kill ring and
> the X selection, and then you will always have to make a conscious
> choice between the two.  But that seems to be what you want. 

Just to be clear, I don't particularly care.  I'm mostly just wondering 
why the behavior mysteriously changed.  But your answer sounds like they 
should have been the same all along. They weren't.  At first, Ctrl-y 
wasn't copying from X.  That's the whole reason I started using the 
other functions in the first place.  It sounds like maybe something 
changed interprogram-paste-function.

-- 
Dan
www.prairienet.org/~dsb

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

* Re: Ctrl-Y is pasting from the clipboard
  2006-12-19 11:16     ` Johan Bockgård
@ 2006-12-22  5:37       ` Dan Bensen
  2006-12-22 13:00         ` Dieter Wilhelm
       [not found]         ` <mailman.2217.1166792441.2155.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 9+ messages in thread
From: Dan Bensen @ 2006-12-22  5:37 UTC (permalink / raw)


>> I thought the emacs kill ring was different from the X clipboard.

Johan Bockgård wrote:>
> (info "(emacs)Clipboard")  <-- C-x C-e

Is C-x C-e supposed to bring up a minibuffer to type the info form?
It didn't work. :/

C-x C-e

Debugger entered--Lisp error: (void-variable 
*****************************************-})
   eval(*****************************************-})
   eval-last-sexp-1(nil)
   eval-last-sexp(nil)
   call-interactively(eval-last-sexp)

-- 
Dan
www.prairienet.org/~dsb

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

* Re: Ctrl-Y is pasting from the clipboard
  2006-12-22  5:37       ` Dan Bensen
@ 2006-12-22 13:00         ` Dieter Wilhelm
       [not found]         ` <mailman.2217.1166792441.2155.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 9+ messages in thread
From: Dieter Wilhelm @ 2006-12-22 13:00 UTC (permalink / raw)
  Cc: help-gnu-emacs

Dan Bensen <randomgeek@cyberspace.net> writes:

>>> I thought the emacs kill ring was different from the X clipboard.
>
> Johan Bockgård wrote:>
>> (info "(emacs)Clipboard")  <-- C-x C-e
>
> Is C-x C-e supposed to bring up a minibuffer to type the info form?
> It didn't work. :/

It'll work as intended when you place your cursor first before above
arrow (<--).

-- 
    Best wishes

    H. Dieter Wilhelm
    Darmstadt, Germany

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

* Re: Ctrl-Y is pasting from the clipboard
       [not found]         ` <mailman.2217.1166792441.2155.help-gnu-emacs@gnu.org>
@ 2006-12-22 14:46           ` Dan Bensen
  0 siblings, 0 replies; 9+ messages in thread
From: Dan Bensen @ 2006-12-22 14:46 UTC (permalink / raw)


Dieter Wilhelm wrote:
> It'll work as intended when you place your cursor first before above
> arrow (<--).
Much better :)

-- 
Dan
www.prairienet.org/~dsb

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

end of thread, other threads:[~2006-12-22 14:46 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-18 18:16 Ctrl-Y is pasting from the clipboard Dan Bensen
2006-12-18 18:51 ` Harald Hanche-Olsen
2006-12-19  5:52   ` Dan Bensen
2006-12-19  9:50     ` Harald Hanche-Olsen
2006-12-22  5:26       ` Dan Bensen
2006-12-19 11:16     ` Johan Bockgård
2006-12-22  5:37       ` Dan Bensen
2006-12-22 13:00         ` Dieter Wilhelm
     [not found]         ` <mailman.2217.1166792441.2155.help-gnu-emacs@gnu.org>
2006-12-22 14:46           ` Dan Bensen

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).