From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Xah Lee Newsgroups: gmane.emacs.help Subject: Re: Compleet buffer to clipboard Date: Mon, 20 Apr 2009 12:18:35 -0700 (PDT) Organization: http://groups.google.com Message-ID: <3bf01a40-bda2-4279-a97c-7f26f1bd4ee3@y10g2000prc.googlegroups.com> References: <2df3a1e3-5c09-4784-8878-21af07cd5b24@q9g2000yqc.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1240269309 28972 80.91.229.12 (20 Apr 2009 23:15:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 20 Apr 2009 23:15:09 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Apr 21 01:16:29 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 1Lw2ix-0000h2-Ik for geh-help-gnu-emacs@m.gmane.org; Tue, 21 Apr 2009 01:16:27 +0200 Original-Received: from localhost ([127.0.0.1]:33634 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lw2hY-0002ed-BF for geh-help-gnu-emacs@m.gmane.org; Mon, 20 Apr 2009 19:15:00 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!y10g2000prc.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help,comp.emacs Original-Lines: 51 Original-NNTP-Posting-Host: 24.6.175.142 Original-X-Trace: posting.google.com 1240255117 24456 127.0.0.1 (20 Apr 2009 19:18:37 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Mon, 20 Apr 2009 19:18:37 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: y10g2000prc.googlegroups.com; posting-host=24.6.175.142; posting-account=bRPKjQoAAACxZsR8_VPXCX27T2YcsyMA User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_4_11; en) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1, gzip(gfe), gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:168634 comp.emacs:98114 X-Mailman-Approved-At: Mon, 20 Apr 2009 19:13:25 -0400 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:63911 Archived-At: On Apr 18, 5:27 am, 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. Here's what i use: (defun copy-all () "Put the whole buffer content into the kill-ring. If narrow-to-region is in effect, then just copy that region." (interactive) (kill-ring-save (point-min) (point-max)) (message "Buffer content copied") ) (defun cut-all () "Cut the whole buffer content into the kill-ring. If narrow-to-region is in effect, then just copy that region." (interactive) (kill-region (point-min) (point-max)) (message "Buffer content cut") ) assigned to Alt+Shift+C and Alt+Shift+X. >From http://code.google.com/p/ergoemacs/ I also find the that select all in emacs (mark-whole-buffer)'s behavior of losing cursor position very annoying. One time i got curious, and checked. This doesn't happen in all editors i know of. With the above 2 commands, now i basically never do select all in emacs. Xah =E2=88=91 http://xahlee.org/ =E2=98=84