emacs-devel
[Top][All Lists]
Advanced

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

Re: keybinding to duplicate the current line.


From: Helmut Eller
Subject: Re: keybinding to duplicate the current line.
Date: Sun, 17 Jan 2010 15:58:05 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

* alin.s [2010-01-17 14:40+0100] writes:

> Do you consider that such a function would be useful for many of you?

A standard keybinding would be useful for me.  I use C-x , because that
key wasn't taken yet.

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)))

(global-set-key "\C-x," 'copy-line)





reply via email to

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