Emacs: Copy Rectangle Region to kill-ring

By Xah Lee. Date: . Last updated: .

When you Alt+x kill-rectangle, the text does not go into emacs kill-ring nor the OS's clipboard.

[see Emacs: Edit Column Text, Rectangle Commands]

Here a command to copy rectangle region to emacs's kill-ring.

(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://ergoemacs.org/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")))

Rectangle Edit Topic

  1. Edit Column Text, Rectangle Commands
  2. Insert Alphabets A to Z
  3. Copy Rectangle Region to kill-ring
  4. Align Text
  5. picture-mode, ASCII Diagram
  6. Make Whitespaces Visible

Elisp Commands Do thing-at-point

  1. Count Words
  2. Run Current File
  3. Delete Current File
  4. Copy File Path
  5. Convert Line Ending
  6. Make Backup
  7. Copy Column of Text to Clipboard
  8. Convert Image File
  9. Dired Rename Space to Hyphen
  10. Python 2to3 Wrapper
  11. Move Code to Files
  12. Update Web Feed
  13. Updating Page Tags
  14. Single Key Copy/Paste Register

If you have a question, put $5 at patreon and message me.
Or Buy Xah Emacs Tutorial
Or buy a nice keyboard: Best Keyboards for Emacs


Emacs Lisp