Function: rectangle-number-lines

rectangle-number-lines is an autoloaded, interactive and byte-compiled function defined in rect.el.gz.

Signature

(rectangle-number-lines START END START-AT &optional FORMAT)

Documentation

Insert numbers in front of the region-rectangle.

START-AT, if non-nil, should be a number from which to begin counting. FORMAT, if non-nil, should be a format string to pass to format along with the line count. When called interactively with a prefix argument, prompt for START-AT and FORMAT.

Probably introduced at or before Emacs version 24.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/rect.el.gz
;;;###autoload
(defun rectangle-number-lines (start end start-at &optional format)
  "Insert numbers in front of the region-rectangle.

START-AT, if non-nil, should be a number from which to begin
counting.  FORMAT, if non-nil, should be a format string to pass
to `format' along with the line count.  When called interactively
with a prefix argument, prompt for START-AT and FORMAT."
  (interactive
   (if current-prefix-arg
       (let* ((start (region-beginning))
	      (end   (region-end))
	      (start-at (read-number "Number to count from: " 1)))
	 (list start end start-at
	       (read-string "Format string: "
			    (rectangle--default-line-number-format
			     start end start-at))))
     (list (region-beginning) (region-end) 1 nil)))
  (unless format
    (setq format (rectangle--default-line-number-format start end start-at)))
  (let ((rectangle-number-line-counter start-at))
    (apply-on-rectangle 'rectangle-number-line-callback
			start end format)))