Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [line-numbers]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
95 views

Position `display-line-numbers-mode` to the left when using `visual-fill-column-mode`?

I am very new to the world of Emacs and therefore I'd like to ask of everyone to be kind, not that I am expecting any flame or hate. (just a reminder) I was recently recommended to use visual-fill-...
Icy-Thought's user avatar
0 votes
1 answer
46 views

`line-number-mode`, but per-buffer (using `smart-mode-line` package)

Is it possible to have the line number where the cursor is shown in the mode-line (or line and column numbers appearing in the buffer) only for certain buffers, while it is disabled for other buffers. ...
Christian Herenz's user avatar
0 votes
1 answer
64 views

View window shifts to right when scrolling to the bottom

I recently starting using vanilla emacs, specifically for org mode. I noticed something odd happening when I try to display line numbers in my files. Near the top of the file, the line numbers are a ...
chimera's user avatar
1 vote
1 answer
39 views

With evil keybindings, how do I navigate using actual lines only if a count is involved?

Before moving to Emacs, I had a Vim setup that included the functionality to navigate between visual lines with j and k by default, but if there was a count involved (e.g. 20j), "regular" ...
najjt's user avatar
  • 33
0 votes
0 answers
27 views

Mixed display-line-numbers-type for evil users?

I want something like: (setq display-line-numbers-type 'mixed) Which count wrapped line as "relative", and count folded line as "visual" Is there any way to achieve this? Say I ...
AidanUnhappy's user avatar
1 vote
1 answer
48 views

M-g M-g <nnn> to end of line (C-e)?

I often have to use this sequence: M-g M-g <nnn> C-e to get to the end of a particular line, for example to place a % or \par in TeX files. Is there some way to combine this into, say (...
sgmoye's user avatar
  • 179
0 votes
1 answer
37 views

How to remove (customize) the color of the bar from global-display-line-numbers-mode?

I want to use relative line numbers and therefore I turned on this mode: Global Display Line Numbers Mode. When I want to customize this variable, there is no option in customizing the color of the ...
MySQLInjection's user avatar
0 votes
1 answer
104 views

Can one enable display-line-numbers in buffer's startup?

How would one enable line numbers on a buffer basis? What I have in mind is a statement in the preamble of the buffer of this form: #+STARTUP: [...(turn on line numbers)...]
user avatar
1 vote
1 answer
431 views

Copy with Line Numbers

I have line-numbers displayed, but when I copy the text, the normal behavior is of course to not include the line numbers in the copied text. However, when I want to paste something on sites like this ...
Jason Hunter's user avatar
1 vote
2 answers
396 views

Constant Font Size In `display-line-numbers-mode` When Zooming In And Out

SOLVED The atom-one-dark theme that I was using was the issue. (add-to-list 'custom-theme-load-path "~/.emacs.d/themes/atom-one-dark") (load-theme 'atom-one-dark t) My init.el: (menu-bar-...
TechTycho's user avatar
0 votes
0 answers
31 views

Relative numbers, bouncing text?

when I put relative numbers on, I get bouncing text when I move up an down. I have short files where this is an issue, so it's not the number length. The entire line reshapes depending on the "...
Vinn's user avatar
  • 293
0 votes
1 answer
533 views

How do I configure Emacs to display of line numbers permanenty [duplicate]

https://www.gnu.org/software/emacs/manual/html_node/efaq/Displaying-the-current-line-or-column.html M-x (global-display-line-numbers-mode) But after I do C-x C-c then it's not configed. How do I make ...
jian's user avatar
  • 103
0 votes
1 answer
80 views

How to set relative line-number digit width?

I have set my number line relative to cursor as such: (global-display-line-numbers-mode 1) (setq display-line-numbers-type 'relative) But, In a long file with line-difference more than 4digit (1000+),...
Garid's user avatar
  • 641
0 votes
1 answer
84 views

Problem With Linux Mint Cinnamon Display of Lines Numbers and Mode Line

Addendum added to respond to the answer and subsequent comments of db48x A few months ago, I migrated from Fedora to Linux Mint 20 (Cinnamon), and then installed Emacs v26.3 in Mint. As shown in the ...
zugzwang's user avatar
  • 319
0 votes
1 answer
131 views

Is it possible to get the line number of the nearest regex match above the current cursor position?

I'd like to write an elisp function that tells me the line number of the closest regex match above my current cursor position. For example, if my cursor is on line 9 of the following file and my regex ...
Brian Fitzpatrick's user avatar
0 votes
1 answer
563 views

Disable line number mode for compilation mode

I have set multiple modes to not show display-line-number-mode and recently I added compilation-mode to that list, but the compilation-mode still shows line numbers. Here is the relevant code, ;; ...
apoorv569's user avatar
  • 113
0 votes
0 answers
44 views

How to separate line numbers from text when using global-display-line-numbers-mode?

Trying global-display-line-numbers-mode, I would like to achieve what linum-format does with: Linum: Separating line numbers from text How to achieve that using global-display-line-numbers-mode?
nephewtom's user avatar
  • 2,261
0 votes
1 answer
96 views

How can I have `menu-bar--display-line-numbers-mode-relative` run in all modes?

I see there is a menu-bar--display-line-numbers-mode-relative function that turns on relative line numbering. Is there a way I can run this in every buffer (basically turn this on everywhere)?
irregular's user avatar
  • 1,022
3 votes
2 answers
123 views

How to get the width of the window without line numbers? (or other content in the fringe)?

The result of window-body-width doesn't change when display-line-number-mode is enabled / disabled. How can I get the window width but excluding the fringe?
ideasman42's user avatar
  • 8,826
5 votes
0 answers
96 views

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). ...
aaa's user avatar
  • 446
1 vote
1 answer
94 views

How to prevent the moving of line numbers in display-line-numbers-mode

Sorry about the title, I don't know how to describe it better. Using display-line-numbers-mode with hs-hide-all to edit a Common Lisp file, I see the line number moving to the right, which is quite ...
C-Entropy's user avatar
  • 143
1 vote
1 answer
129 views

show line number when matching parathenses/braces

I work with latex/other documents with long nested of texts/codes are enclosed by paratheses or braces, like this: { long blocks of latex or other materials ( another long blocks of texts ...
underflow's user avatar
  • 111
0 votes
2 answers
1k views

Org mode: Enable line numbers only in source code blocks

Is there a way to enable line numbers only for the source code blocks between #+BEGIN_SRC and #+END_SRC?
Mountain's user avatar
  • 121
1 vote
0 answers
18 views

Indicate line number thresold

How can I have a ruler displayed on a specific linenumber e.g. 20? Similar to M-x ruler-mode though for lines/rows instead of columns
jjk's user avatar
  • 744
1 vote
1 answer
76 views

How to fix buffer-local variable?

I have the following in my init.el, (setq-default display-line-numbers 'visual) (global-display-line-numbers-mode 1) which should give me relative line numbering. On starting emacs, it does on the ...
shem's user avatar
  • 13
1 vote
1 answer
112 views

How to check if point moved or is on a different line in a buffer since the last user command?

I would like to make a snippet of code that only executes if the point is on a different line in a particular buffer since the last user command. The only way I could think to do it was using the post-...
shankar2k's user avatar
  • 175
0 votes
1 answer
95 views

How to let line numbers count from 1 in org subtree?

When I narrow an org mode header into a subtree(using command org-narrow-to-subtree) in vanilla Emacs, the line number counts from 1 in the subtree, but when I create a subtree in Doom Emacs, the line ...
Searene's user avatar
  • 499
0 votes
1 answer
289 views

Toggle between relative and absolute line numbers: Lisp Syntax

I need to define a function that toggles between value of display-line-numbers but can't figure out what's the correct lisp syntax to do so. Here's what I want to do: Check if value of display-line-...
Chinmay Chhajed's user avatar
0 votes
0 answers
41 views

How can I add some line numbers of emacs into pdf created by latex

Is it possible to print Line Number in emacs to the Latex pdf for lines that I prefer? If it is easy, I want to use those numbers with M-g M-g (goto-line command) Edit: To make the question more clear,...
Atbey's user avatar
  • 101
0 votes
1 answer
414 views

How to get the real line number of a selection?

I am trying to figure out the line numbers referring to the actual selection. What I came up with is something like this (let ((start (line-number-at-pos (region-beginning))) (end (line-number-...
KARASZI István's user avatar
2 votes
1 answer
237 views

Number of line as you'd get moving down the buffer with C-n

In a buffer in Emacs, a line is the text you get from the first character after you press "Enter" to the last character before the next "Enter". And so, this is the line numbers ...
Matematikisto's user avatar
0 votes
0 answers
288 views

How can I disable line numbers on empty lines?

I find it easier to visualize double line breaks if there's actually blank space between paragraphs. I never need to see the line number of a blank line, but I do really like seeing a line number when ...
Oliver Richardson's user avatar
0 votes
1 answer
88 views

How to ignore emtpy lines on the bottom of the buffer?

When I jump to bottom part of the buffer using vi I does not show any empty lines. On emacs when I got to bottom of the buffer I see empty lines even there is no new lines exist. Is is possible to ...
alper's user avatar
  • 1,390
1 vote
2 answers
87 views

Strange behaivor counting lines in hooks `find-file-hook` or `text-mode-hook`

For me, the clearest measure for the size of a file is its number of lines. So, I want this information in my mode line. I am using Doom emacs and, even I could define my own mode line, for such a ...
MonLau's user avatar
  • 81
2 votes
1 answer
788 views

Emacs + visual line numbers + folding + visual fill column mode

Relative line numbers for me it's a little bit painful topic. I'm using evil (spacemacs) and I want to jump between lines by in vim style like 10j, 4k etc. Is it possible to get line numbers behavior ...
HarryFox's user avatar
5 votes
1 answer
1k views

Change line number format with line-number-mode

With linum-mode, you could change how the line numbers appears by customizing linum-format. line-number-mode appears to have replaced linum-mode, and indeed it is better (for one thing, it correctly ...
asmeurer's user avatar
  • 1,582
4 votes
1 answer
894 views

Uneven line numbers with display-line-numbers

Emacs for some reason did not vacate equal spaces for each line number, So the lines were starting at different places which made it harder to keep track of alignment. It wasn't just the relative mode ...
sidharth arya's user avatar
8 votes
1 answer
5k views

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 ...
dylanjm's user avatar
  • 323
1 vote
1 answer
181 views

Add paragraph numbers

I have a longish document and I want to number the paragraphs. So, Here is the first paragraph. It could span multiple visual lines. Two paragraphs are separated by an empty line. converts to : 1 ...
deshmukh's user avatar
  • 1,912
4 votes
1 answer
785 views

Setting relative line numbers when in programming modes

Looking to set relative line numbers when in programming modes. Looking through the older posts I see a way to set line numbers based on the mode - How do I display line numbers in emacs (not in the ...
hicksca's user avatar
  • 43
1 vote
0 answers
120 views

Huge buggy padding in line-number buffer

A picture: As you can see there is a huge waste of space on the left side of the line number section. When I increase the font size the padding even increases and does not decrease when I decrease ...
tbrodbeck's user avatar
  • 189
0 votes
1 answer
157 views

auto-start of linum mode doesn't work

I'm currently using spacemacs. I have put the line (global-linum-mode t) into the .spacemacs file but it doesn't work at all. It used to work when I used the normal emacs. I don't have any clue of ...
user avatar
4 votes
0 answers
263 views

Are zero-based column numbers an Emacs idiosyncrasy?

The first line of a text file is line number 1 in probably every application I have ever come across, including Emacs. Every application I have at hand also uses column number 1 for the first column ...
Lassi's user avatar
  • 377
2 votes
3 answers
481 views

How to display absolute line numbers of a full, widened buffer when narrowing to just part of it?

This question applies in the context of all line numbering implementations I've tried, including line-number, nlinum, and linum, so I have a feeling that the answer will have something to do with ...
eeowaa's user avatar
  • 372
0 votes
1 answer
293 views

Line numbers break scroll margin

I'm trying to set a scroll margin to emacs with the scroll-margin variable, but I've noticed that when you do that and you have display-line-numbers-mode enabled, the scrolling doesn't work properly ...
Jesse's user avatar
  • 1,994
2 votes
2 answers
746 views

Elisp program to insert line numbers into a buffer?

I am NOT looking for emacs's line-number mode. I don't want to just display line numbers. I want to insert line numbers in a buffer, starting at point and going to mark, or perhaps continuing for some ...
Reb.Cabin's user avatar
  • 721
3 votes
1 answer
741 views

terminal fringes and diff-hl

I use diff-hl to highlight changed lines. However it doesn't play well in terminal mode. I know that terminal Emacs doesn't support fringes, and it is better to use diff-hl-margin-mode instead, it ...
zzell's user avatar
  • 31
2 votes
0 answers
420 views

Global display line numbers mode not working

I can run (display-line-numbers-mode) and get line numbers but it doesn't work if I run (global-display-line-numbers-mode) (nothing happens). I have traced this to this function: (defun display-line-...
Joseph Garvin's user avatar
2 votes
0 answers
351 views

Show Git gutter after linenumbers

I am using emacs-nox and as some of you know there are always some problems if you want to display you line numbers while also using git-gutter. (Stuff like some extra margin jumping numbers etc.) ...
Phillip's user avatar
  • 121
1 vote
1 answer
205 views

Hook when line number changes

Is there a hook which runs when the cursor position changes its current line numbers? For a concrete toy problem, can i highlight the current line as yellow when the line number of the current cursor ...
mangoemacs's user avatar