Subject: bug#7503: copy-and-insert-previous-line

From: Andreas Schwab <[email-masked]>
Date: Sun, 28 Nov 2010 12:10:25 +0100

Mads Jensen <[email-masked]> writes:

> I couldn't find a similar macro which did the same trick, so I wrote one
> myself:
>
> (defun copy-and-insert-previous-line ()
>   (interactive)
>   (save-excursion
>     (goto-line (1- (line-number-at-pos)))
      (forward-line -1)

>     (copy-current-line))

This function is not defined.

>   (yank))

(defun duplicate-previous-line ()
  (interactive "*")
  (save-excursion
    (insert
     (buffer-substring (progn (forward-line -1) (point))
		       (progn (forward-line 1) (point))))))

Andreas.

-- 
Andreas Schwab, [email-masked]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."