* lisp/misc.el (duplicate--insert-copies): New.
(duplicate-line, duplicate-dwim): Call it.
(+ n (point)))))))
(insert string)))
+(defun duplicate--insert-copies (n string)
+ "Insert N copies of STRING at point."
+ (insert (mapconcat #'identity (make-list n string))))
+
;;;###autoload
(defun duplicate-line (&optional n)
"Duplicate the current line N times.
(forward-line 1)
(unless (bolp)
(insert "\n"))
- (dotimes (_ n)
- (insert line)))))
+ (duplicate--insert-copies n line))))
(declare-function rectangle--duplicate-right "rect" (n))
(text (buffer-substring beg end)))
(save-excursion
(goto-char end)
- (dotimes (_ n)
- (insert text))))
+ (duplicate--insert-copies n text)))
(setq deactivate-mark nil))
;; Duplicate line.