How to copy the current line below in Emacs Lisp?
September 10, 2023
(defun copy-current-line-below ()
"Copy current line and past it below"
(interactive)
(let ((line (buffer-substring (point-at-bol) (point-at-eol))))
(save-excursion
(forward-line)
(insert line "\n"))))
You might be interested in:
How to get the content in buffers in Emacs Lisp? (
buffer-substring
) andHow to insert foo at the end of buffer without changing point with Emacs Lisp? (
save-excursion
).