Remove line numbers from code in emacs

Useful if you’re copy & pasting.

query-replace-regexp ^[[:digit:]]+\.? ?

Or even better, define this function in your .emacs

(defun remove-line-numbers ()
"remove line numbers"
(interactive "*")
(beginning-of-buffer)
(replace-regexp "^[[:digit:]]+\.? ?" ""))

Leave a Reply

Your email address will not be published. Required fields are marked *