From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.help Subject: Re: Compleet buffer to clipboard Date: Tue, 21 Apr 2009 06:55:26 +0000 Message-ID: <20090421065526.GA1082@muc.de> References: <2df3a1e3-5c09-4784-8878-21af07cd5b24@q9g2000yqc.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1240296969 15949 80.91.229.12 (21 Apr 2009 06:56:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 21 Apr 2009 06:56:09 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Decebal Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Apr 21 08:57:28 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Lw9v3-0001NW-QR for geh-help-gnu-emacs@m.gmane.org; Tue, 21 Apr 2009 08:57:26 +0200 Original-Received: from localhost ([127.0.0.1]:45106 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lw9te-0000kT-SR for geh-help-gnu-emacs@m.gmane.org; Tue, 21 Apr 2009 02:55:58 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Lw9tI-0000jP-Cz for help-gnu-emacs@gnu.org; Tue, 21 Apr 2009 02:55:36 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Lw9tD-0000hl-Tx for help-gnu-emacs@gnu.org; Tue, 21 Apr 2009 02:55:36 -0400 Original-Received: from [199.232.76.173] (port=56933 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lw9tD-0000hg-O5 for help-gnu-emacs@gnu.org; Tue, 21 Apr 2009 02:55:31 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:3141 helo=mail.muc.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Lw9tD-0001K3-5q for help-gnu-emacs@gnu.org; Tue, 21 Apr 2009 02:55:31 -0400 Original-Received: (qmail 99875 invoked by uid 3782); 21 Apr 2009 06:55:28 -0000 Original-Received: from acm.muc.de (pD9E5333A.dip.t-dialin.net [217.229.51.58]) by colin2.muc.de (tmda-ofmipd) with ESMTP; Tue, 21 Apr 2009 08:55:26 +0200 Original-Received: (qmail 1232 invoked by uid 1000); 21 Apr 2009 06:55:26 -0000 Content-Disposition: inline In-Reply-To: <2df3a1e3-5c09-4784-8878-21af07cd5b24@q9g2000yqc.googlegroups.com> User-Agent: Mutt/1.5.9i X-Delivery-Agent: TMDA/1.1.5 (Fettercairn) X-Primary-Address: acm@muc.de X-detected-operating-system: by monty-python.gnu.org: FreeBSD 4.6-4.9 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:63917 Archived-At: Hi, Decebal, On Sat, Apr 18, 2009 at 05:27:38AM -0700, Decebal wrote: > A lot of times I want to copy the complete buffer to the clipboard. > This is possible with: > C-x h > M-w > But one of the complications is that you lose your cursor position. > When you put in yor .emacs: > (defun buffer-yank() > (interactive) > (kill-new (buffer-substring (point-min) (point-max)))) > (global-set-key (kbd "C-c C-a") 'buffer-yank) > Then you can use: > C-c C-a > to copy the complete buffer to the clipboard. Sort of, some of the time. C-c C-a is a binding reserved for major modes (see page "Key Binding Conventions" in the elisp manual). If you're in a major mode which actually uses this binding (e.g. C Mode, Diff Mode), it will take precedence over your `buffer-yank'. You might be better using a binding reserved for users, say C-c a. -- Alan Mackenzie (Nuremberg, Germany).