Emacs - Copy Line

To get the equivalent of kill line command in emacs for copying purposes, I use the following code snippet. Just copy paste it in your .emacs file. (defun copy-line (arg) "Copy lines (as many as prefix argument) in the kill ring" (interactive "p") (kill-ring-save (line-beginning-position) (line-beginning-position (+ 1 arg))) (message "%d line%s copied" arg (if (= 1 arg) "" "s"))) (global-set-key "\\M-k" 'copy-line) If \C is your control key then \M is your alt key....

October 2, 2012 · 1 min · 130 words
*/}}