How would you go about writing a file from emacs that contains only the line numbers eg:
1
2
3
4
5
Ideally this would be a command that you would execute (how?) that can be told how many lines to print. Is this possible?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Here’s a quick elisp function that does it:
You would run it with
(write-line-numbers 8)in elisp or with M-x write-line-numbers 8 interactively.Or you could save the above as a script and run emacs like so:
But as Moritz points out, there are better ways to do this outside of emacs.