How can I make an emacs command to copy text (to the kill ring) by appending? (Why is there no such built-in command?)
Appending Kills mentions C-M-w (`append-next-kill') which allows me to append with kill commands such as C-d or C-k. But it's for killing texts instead of copying them.
Actually, there is such a built in command.  C-M-w will append a subsequent copy as well as a kill.  So you would mark the region you desire to copy, then type C-M-w followed by M-w and the next C-y will yank the joined kills.
Play with a variation of this in your .emacs file...
(defun append-kill-line (&optional arg)
  "Append kill-line to current kill buffer, prefix arg kills from beginning of line."
  (interactive "P")
  (append-next-kill)
  (kill-line arg)
)
(define-key global-map "\C-x\C-m" 'append-kill-line)
                        Can append-to-register meet your needs?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With