Emacs: Copy Rectangle Region to kill-ring 🚀

By Xah Lee. Date: . Last updated: .

Here a command to copy rectangle region to emacs's kill-ring. [see Emacs: Edit Column Text, Rectangle]

💡 TIP: you can use copy-rectangle-to-register to copy it to register. [see Emacs: Copy to Register]

put this in your Emacs Init File:

(defun xah-copy-rectangle-to-kill-ring (Begin End)
  "Copy region as column (rectangle region) to `kill-ring'
See also: `kill-rectangle', `copy-to-register'.

URL `http://xahlee.info/emacs/emacs/emacs_copy_rectangle_text_to_clipboard.html'
Version: 2016-07-17"
  ;; extract-rectangle suggested by YoungFrog, 2012-07-25
  (interactive "r")
  (require 'rect)
  (kill-new (mapconcat #'identity (extract-rectangle Begin End) "\n")))

Emacs: Comment, Uncomment, Rectangle Edit