This code copies the current line:
(defun copy-line ()
"Copy the whole line that point is on."
(interactive)
(let ((beg (line-beginning-position 1))
(end (line-beginning-position 2)))
(if (eq last-command 'quick-copy-line)
(kill-append (buffer-substring beg end) (< end beg))
(kill-new (buffer-substring beg end)))))
, but this one also uses kill, which marks the buffer as changed.
Can we "copy", so that the buffer remains unchanged?