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

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

Re: copy-line


From: Helmut Eller
Subject: Re: copy-line
Date: Sun, 01 Feb 2009 09:41:55 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Thanks to everyone who replied.
Apparently Emacs has no standard command to do that.
I'll use the code below and bind it to C-x ,

Helmut.

(defun copy-line ()
  "Copy the current line."
  (interactive)
  (let ((col (current-column))
        (beg (progn (beginning-of-line) (point)))
        (end (progn (end-of-line) (point))))
    (forward-line)
    (save-excursion (insert (buffer-substring beg end) "\n"))
    (move-to-column col)))


reply via email to

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