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

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

Re: copy-line


From: Bastien
Subject: Re: copy-line
Date: Tue, 24 Jul 2012 19:44:57 +0200
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.1.50 (gnu/linux)

Enda <enda_k2@yahoo.com> writes:

> Usedn't there be a copy-line in Emacs (which would copy the line). In
> Vi, copying a line is yy, what is the shortest way of copying a line
> in Emacs (without writing a lisp function in .emacs)? Should there be
> a default keystroke for copying a line?

What about one of these two?

(defun kill-line-save (&optional arg)
  "Save the rest of the line as if killed, but don't kill it."
  (interactive "P")
  (let ((buffer-read-only t))
    (kill-line arg)
    (message "Line(s) copied to the kill ring")))

(defun copy-line (&optional arg)
  "Copy the current line."
  (interactive "P")
  (copy-region-as-kill
   (point-at-bol)
   (+ (if kill-whole-line 1 0) (point-at-eol arg))))

-- 
 Bastien



reply via email to

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