I want to be able to kill selected text and yank it to the bottom of the buffer from which it was killed.

How do I do this efficiently, meaning not with C-k, moving point to end of buffer, C-y?

2 Answers 2


I don't think there's anything built-in that's more efficient than this:

  1. select text
  2. kill selection with C-w
  3. move to end of buffer with M-> (i.e., end-of-buffer)
  4. yank C-y
  5. return to where I started with C-u <space> <space>

If you do this a lot, you can wrap these operations into a function:

(defun my-yank-at-end (beg end)
  (interactive "r")
    (let ((target (kill-region beg end )))
      (insert "\n")

This function assumes you've got an active selection before you call it. It also adds a newline before it yanks the selection.

  • Perfect! Thanks! Needs another closing parenthesis, btw. Commented Oct 27, 2016 at 20:09

I'd rather use standard keyboard short-cuts or the customised solution of @Taylor above, but for completenes sake here are two out of the box Emacs ways:

append-to-file: Save your buffer (so it's only working for buffers with an underlying file) and select a region, then M-x a-t-f and specifying your-file will ad the region is at the end of your-file. (To see this change in the current buffer you have to revert the buffer, which will happen after you start editing and Emacs warns you that your buffer is not updated and you press r.)

append-to-buffer: Interactively this appends the region only behind the current point. So M-x a-t-b and specifying your-buffer doesn't work exactly for the use case above but for appending to other buffers it's very convenient.

  • Reverting the buffer doesn't happen automatically by default. I think maybe you have auto-revert-mode enabled?
    – Tyler
    Commented Oct 28, 2016 at 13:23
  • True @Tyler, I meant when you start editing you will be warned and by pressing r the buffer will be reverted, I updated my answer accordingly, thanks. Commented Oct 29, 2016 at 17:32
  • 1
    huh, I never noticed the r option before!
    – Tyler
    Commented Oct 29, 2016 at 23:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.