From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Harald Hanche-Olsen Newsgroups: gmane.emacs.help Subject: Re: Ctrl-Y is pasting from the clipboard Date: Tue, 19 Dec 2006 10:50:13 +0100 Organization: Norwegian university of science and technology Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1166524847 1474 80.91.229.2 (19 Dec 2006 10:40:47 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 19 Dec 2006 10:40:47 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Dec 19 11:40:42 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GwcOj-0003Uu-Hh for geh-help-gnu-emacs@m.gmane.org; Tue, 19 Dec 2006 11:40:37 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GwcOi-0005po-Ub for geh-help-gnu-emacs@m.gmane.org; Tue, 19 Dec 2006 05:40:37 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!uninett.no!ntnu.no!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 53 Original-NNTP-Posting-Host: fiinbeck.math.ntnu.no Original-X-Trace: orkan.itea.ntnu.no 1166521571 13966 129.241.15.140 (19 Dec 2006 09:46:11 GMT) Original-X-Complaints-To: usenet@itea.ntnu.no Original-NNTP-Posting-Date: Tue, 19 Dec 2006 09:46:11 +0000 (UTC) User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.0 (berkeley-unix) Cancel-Lock: sha1:mD8OOZ7QJPg+6/oI9Ex5Ek2XFfs= Original-Xref: shelby.stanford.edu gnu.emacs.help:144124 Original-To: help-gnu-emacs@gnu.org 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:39727 Archived-At: + Dan Bensen : | 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 - It is undesirable to believe a proposition when there is no ground whatsoever for supposing it is true. -- Bertrand Russell