1

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?

Basil
  • 12,019
  • 43
  • 69
RafaelGP
  • 291
  • 2
  • 6

1 Answers1

4

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

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

Basil
  • 12,019
  • 43
  • 69
legoscia
  • 6,012
  • 29
  • 54