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

From: Mads Jensen <[email-masked]>
Date: Sun, 28 Nov 2010 15:32:33 +0100

Andreas Schwab wrote:
>> (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.

Sorry for not remembering to attach this one, too.

(defun copy-current-line ()
  (interactive)
  (kill-ring-save (point-at-bol) (point-at-eol)))

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

There is a difference between my version, and this one, as mine doesn't
add the newline-character from the end of the previous line.

I'm using Emacs 22.2.1 as Emacs 23 is not the default in Ubuntu 9.10.
Thanks for the quick response :-)
-- 
Med Venlig Hilsen / Kind Regards,
Mads Jensen
Rubinsteinsvej 31,st.th
DK-2450 Kbh. SV
Denmark