5

When I enable line numbers in Emacs the cursor starts in a line with no number in it. If you press enter then the numbers increment but always there is a line with no number. Why is that happening?

enter image description here

enter image description here

5

Because the last line hasn't started yet. Adding newline symbol to the end makes the cursor jump from the current line to the next one, but it doesn't add anything to it (new one). Strictly speaking, it is not a line yet.

Supposing that every newline symbol was visible, you would get

1. <newline_symbol>
2. <newline_symbol>
3. <newline_symbol>
   <cursor_there_and_nothing_else>

Once you start typing in this line, it receives some content, so the number will appear.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.