Function: array-copy-row-down

array-copy-row-down is an interactive and byte-compiled function defined in array.el.gz.

Signature

(array-copy-row-down &optional ARG)

Documentation

Copy the entire current row one row down.

If optional ARG is given, copy through ARG rows down.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/array.el.gz
(defun array-copy-row-down (&optional arg)
  "Copy the entire current row one row down.
If optional ARG is given, copy through ARG rows down."
  (interactive "p")
  (array-update-buffer-position)
  (array-update-array-position)
  (if (not array-row)
      (error "Cursor is not in a valid array cell"))
  (cond
   ((and (= array-row 1) (= arg -1))
    (error "Beginning of array"))
   ((and (= array-row array-max-row) (= arg 1))
    (error "End of array"))
   (t
    (let* ((array-copy-string
	    (buffer-substring
	     (save-excursion (array-move-to-cell array-row 1)
			     (point))
	     (save-excursion (array-move-to-cell array-row array-max-column)
			     (forward-line 1)
			     (point))))
	   (this-row array-row)
           (goal-row (array--limit-index (+ this-row arg) array-max-row))
	   (num (- goal-row this-row))
	   (count (abs num))
	   (sign (if (not (zerop count)) (/ num count))))
      (while (> count 0)
	(setq this-row (+ this-row sign))
	(array-move-to-cell this-row 1)
	(let ((inhibit-quit t))
	  (delete-region (point)
			 (save-excursion
			   (array-move-to-cell this-row array-max-column)
			   (forward-line 1)
			   (point)))
	  (insert array-copy-string))
	(setq count (1- count)))
      (array-move-to-cell goal-row (or array-column 1)))))
  (array-normalize-cursor))