unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Xah Lee <xahlee@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Compleet buffer to clipboard
Date: Mon, 20 Apr 2009 12:18:35 -0700 (PDT)	[thread overview]
Message-ID: <3bf01a40-bda2-4279-a97c-7f26f1bd4ee3@y10g2000prc.googlegroups.com> (raw)
In-Reply-To: 2df3a1e3-5c09-4784-8878-21af07cd5b24@q9g2000yqc.googlegroups.com

On Apr 18, 5:27 am, Decebal <CLDWester...@gmail.com> 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
∑ http://xahlee.org/

  parent reply	other threads:[~2009-04-20 19:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-18 12:27 Compleet buffer to clipboard Decebal
2009-04-18 16:27 ` Drew Adams
     [not found] ` <mailman.5623.1240072028.31690.help-gnu-emacs@gnu.org>
2009-04-18 16:39   ` Decebal
2009-04-18 17:41     ` B. T. Raven
2009-04-18 17:58       ` B. T. Raven
2009-04-19  5:51         ` Decebal
2009-04-20 19:18 ` Xah Lee [this message]
2009-04-21  6:55 ` Alan Mackenzie
     [not found] ` <mailman.5756.1240296937.31690.help-gnu-emacs@gnu.org>
2009-04-21  7:40   ` Decebal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3bf01a40-bda2-4279-a97c-7f26f1bd4ee3@y10g2000prc.googlegroups.com \
    --to=xahlee@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).