Questions tagged [line-numbers]
77 questions
66
votes
8 answers
How do I display line numbers in emacs (not in the mode line)?
I know how to display line numbers (and columns) in the mode-line, but I'd like emacs to display the line numbers for all the lines on the left-hand side. I've seen this done in vim and other text editors. How do I do this for emacs?

programking
- 7,064
- 9
- 41
- 62
22
votes
3 answers
A faster method to obtain `line-number-at-pos` in large buffers
The function line-number-at-pos (when repeated about 50 times) is causing a noticeable slow-down in semi-large buffers -- e.g., 50,000 lines -- when point is near the end of the buffer. By slow-down, I mean a combined total of about 1.35…

lawlist
- 18,826
- 5
- 37
- 118
21
votes
3 answers
Show line number on error
Say that emacs throws some error that I don't understand. Or maybe the error says "Symbol's value as variable is void: modes", but there are many occurrences of the symbol modes in my code, so I need some context. Can Emacs be configured to mention…

Jackson
- 1,218
- 9
- 19
13
votes
3 answers
Permanently display line numbers in emacs
I am asking this after having read this post:
How do I display line numbers in emacs (not in the mode line)?
I have tried using:
M-x linum-mode
and
display-line-numbers-mode
After closing emacs and reopening, they are gone. Is there not a way to…

user1394
- 231
- 1
- 2
- 6
12
votes
1 answer
How do I enable line numbers (on the left) every time when line is the long logical line
I have linum-mode enabled as well as truncate-lines. Works fine as long as Emacs displays column 0:
The line number is showed on left (OK)
But as soon as the window is scrolled horizontally, the line numbers disappear:
The line number is not…

user3875715
- 121
- 2
8
votes
1 answer
How to determine the line number of the first visible line of a window?
How to determine the line number of the first visible line of a window?

Name
- 7,689
- 4
- 38
- 84
7
votes
2 answers
Any way to get a working separator line between fringe/line numbers and the buffer?
is there any way to get a separator like the one for the split buffers (line in the middle of the image) for the line numbers/fringe?
I tried (setq linenum-format "%4d \u2502 ") but that gives me a buggy weird broken lines with varying widths -.-

nemesit
- 291
- 1
- 5
7
votes
1 answer
How to change line-number gutter width using display-line-numbers mode?
I am using (global-display-line-numbers-mode 1) in my init.el file and everything is working as expected. The only problem is that I find the gutter width to be too wide and would prefer it to match the size that's used when using (linum-mode 1).
I…

dylanjm
- 303
- 2
- 10
7
votes
1 answer
Problem with line number limit in linum-mode
I am using the term of Emacs to compile some code, with linum-mode enabled to display the line numbers for the terminal, and the line numbers stop increasing as soon as they reach 2049.
If I write source code and I reach 2049 lines will this happen…

Adam
- 2,407
- 2
- 21
- 38
6
votes
0 answers
Making relative line numbers behave well with folds?
Context: I have relative line numbers displayed in emacs. If there is a fold (for example: in org-mode), these relative numbers appear to "jump". For example if I'm on line 0 over a fold, emacs could show me that the next line visible is "50 lines"…

George
- 879
- 5
- 17
5
votes
0 answers
Is there a way to display the number of lines in a fold?
I have tons of nested headings in Org-mode files, usually collapsed, and I'd like to have a quick look at how many lines are under each of collapsed headings (mostly top-level but sometimes not). Having absolute line numbers displayed sort of works,…

aaa
- 426
- 3
- 9
5
votes
1 answer
disable line numbers in helm buffers , emacs 26
I have emacs 26 installed and helm.
I would like to disable line numbers in helm buffers ( and other buffers that has no use of line numbers)
is there anyway to disable the native line number in those buffers or even better disable it in…

Ayed
- 185
- 5
5
votes
1 answer
Confusion with line numbers
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?

Adam
- 2,407
- 2
- 21
- 38
5
votes
1 answer
Absolute line numbers on the current and relative line numbers on all other lines?
I know this plugin for relative numbers, which works fine (with the option (global-relative-line-numbers-mode). I also know this elisp code, which gives me perfectly working absolute numbers:
(add-hook 'find-file-hook (lambda () (linum-mode…

toogley
- 303
- 2
- 15
5
votes
2 answers
Zero-indexed line numbering
I'm working with a file which is zero-indexed. Using M-x linum-mode, I can get emacs to display line numbers. How can I get emacs to start counting from 0 instead of 1?

shimao
- 163
- 5