Created
December 7, 2015 18:25
-
-
Save maw/2f30ba164824f3c4a5d9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; http://emacs.stackexchange.com/a/3174 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))) | |
(with-temp-buffer | |
(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