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?
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.Sign up to join this community
I don't think there's anything built-in that's more efficient than this:
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") (save-excursion (let ((target (kill-region beg end ))) (end-of-buffer) (insert "\n") (yank))))
This function assumes you've got an active selection before you call it. It also adds a newline before it yanks the selection.
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
append-to-buffer: Interactively this appends the region only behind the current
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.