Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
;; via xtreak on freenode
(defun youngfrog/copy-rectangle-to-kill-ring (start end)
"Saves a rectangle to the normal kill ring. Not suitable for yank-rectangle."
(interactive "r")
(let ((lines (extract-rectangle start end)))
(while lines ;; insert-rectangle, but without the unneeded stuff
;; (most importantly no push-mark)
(insert-for-yank (car lines))
(insert "\n")
(setq lines (cdr lines)))
(kill-ring-save (point-min) (point-max)))))
(defun kill-rectangle-as-text (b e)
(interactive "r")
(progn (youngfrog/copy-rectangle-to-kill-ring b e)
(delete-rectangle b e)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment