Copying the Whole Buffer

Tim Bray tweeted a nice bit of elisp to copy the current buffer to the kill ring:

The normal method—or at least my normal method—is to mark the buffer with Ctrl+x h and then copy it to the kill ring with Meta+w. That’s pretty simple and it’s burned into my muscle memory but I do that operation a lot so it probably makes sense to get it bound to a single key sequence. In any event, if you often find yourself wanting to capture the buffer so you can paste it somewhere else, Bray’s code is just what you need.

My only quibble is binding it to Meta+a. By default, that’s bound to either backward-sentence or org-backward-sentence, which I use all the time. If you use or think you might use the go to beginning and end of sentence functions, you should probably bind Bray’s code to something else.

This entry was posted in General and tagged . Bookmark the permalink.