Function: rectangle--duplicate-right

rectangle--duplicate-right is a byte-compiled function defined in rect.el.gz.

Signature

(rectangle--duplicate-right N)

Documentation

Duplicate the rectangular region N times on the right-hand side.

Source Code

;; Defined in /usr/src/emacs/lisp/rect.el.gz
(defun rectangle--duplicate-right (n)
  "Duplicate the rectangular region N times on the right-hand side."
  (let ((cols (rectangle--pos-cols (point) (mark))))
    (apply-on-rectangle
     (lambda (startcol endcol)
       (let ((lines (list nil)))
         (extract-rectangle-line startcol endcol lines)
         (move-to-column endcol t)
         (dotimes (_ n)
           (insert (cadr lines)))))
     (min (point) (mark))
     (max (point) (mark)))
    ;; Recompute the rectangle state; no crutches should be needed now.
    (let ((p (point))
          (m (mark)))
      (rectangle--reset-crutches)
      (goto-char m)
      (move-to-column (cdr cols) t)
      (set-mark (point))
      (goto-char p)
      (move-to-column (car cols) t))))