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: Andreas Schwab
Subject: bug#7503: copy-and-insert-previous-line
Date: Sun, 28 Nov 2010 12:10:25 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2.90 (gnu/linux)

Mads Jensen <mje@inducks.org> 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, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."





reply via email to

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