Function: kill-rectangle
kill-rectangle is an autoloaded, interactive and byte-compiled
function defined in rect.el.gz.
Signature
(kill-rectangle START END &optional FILL)
Documentation
Delete the region-rectangle and save it as the last killed one.
When called from a program the rectangle's corners are START and END.
You might prefer to use delete-extract-rectangle from a program.
With a prefix (or a FILL) argument, also fill lines where nothing has to be deleted.
If the buffer is read-only, Emacs will beep and refrain from deleting
the rectangle, but put it in killed-rectangle anyway. This means that
you can use this command to copy text from a read-only buffer.
(If the variable kill-read-only-ok is non-nil, then this won't
even beep.)
Probably introduced at or before Emacs version 1.9.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/rect.el.gz
;;;###autoload
(defun kill-rectangle (start end &optional fill)
"Delete the region-rectangle and save it as the last killed one.
When called from a program the rectangle's corners are START and END.
You might prefer to use `delete-extract-rectangle' from a program.
With a prefix (or a FILL) argument, also fill lines where nothing has to be
deleted.
If the buffer is read-only, Emacs will beep and refrain from deleting
the rectangle, but put it in `killed-rectangle' anyway. This means that
you can use this command to copy text from a read-only buffer.
\(If the variable `kill-read-only-ok' is non-nil, then this won't
even beep.)"
(interactive "r\nP")
(condition-case nil
(let (indent-tabs-mode)
(setq killed-rectangle (delete-extract-rectangle start end fill)))
((buffer-read-only text-read-only)
(setq deactivate-mark t)
(setq killed-rectangle (extract-rectangle start end))
(if kill-read-only-ok
(progn (message "Read only text copied to `killed-rectangle'") nil)
(barf-if-buffer-read-only)
(signal 'text-read-only (list (current-buffer)))))))