How can I make a function that copies text from line number N
at point? I will be at some specific line and point position and want to copy the text from a different line N
.
1 Answer
(defun foo (n)
"Copy line N to the kill-ring.
N is the numeric prefix arg"
(interactive "p")
(save-excursion
(goto-char (point-min))
(forward-line (1- n))
(kill-ring-save (line-beginning-position) (line-end-position))))