bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Mads Jensen
Subject: bug#7503: copy-and-insert-previous-line
Date: Sun, 28 Nov 2010 15:32:33 +0100
User-agent: Thunderbird 2.0.0.24 (X11/20101027)

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


Attachment: signature.asc
Description: PGP signature

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]