0

I'm trying to use the following function (extracted from the amazing emacs-prelude configuration)

(defun prelude-duplicate-current-line-or-region (arg)
  "Duplicates the current line or region ARG times.
If there's no region, the current line will be duplicated.  However, if
there's a region, all lines that region covers will be duplicated."
  (interactive "p")
  (pcase-let* ((origin (point))
               (`(,beg . ,end) (prelude-get-positions-of-line-or-region))
               (region (buffer-substring-no-properties beg end)))
    (-dotimes arg
      (lambda (n)
        (goto-char end)
        (newline)
        (insert region)
        (setq end (point))))
    (goto-char (+ origin (* (length region) arg) arg))))

But I get the following error:

symbol's function definition is void: -dotimes

Any ideas why do I get this error? Do I have a library missing or something?

3

The -dotimes function, and other functions starting with a dash, can be found in the dash library. It's available on MELPA.

(Not to be confused with dotimes, without a dash, which is built in to Emacs.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.