Emacs Duplicate line

From: http://computingfunnyfacts.blogspot.com/2007/12/duplicate-line-in-emacs.html

;; Duplicate line
(defun duplicate-line()
 "Duplicate line."
 (interactive)
 (let (
       (beg (line-beginning-position))
       (end (line-end-position)))
   (copy-region-as-kill beg end)
   (beginning-of-line)
   (forward-line 1)
   (yank)
   (newline)
   (forward-line -1)))
Advertisements