Questions tagged [line-numbers]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
23 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
46 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
24 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
86 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
275 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
270 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
29 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
  • 283
0 votes
1 answer
390 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
52 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
  • 589
0 votes
1 answer
64 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
105 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
418 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
34 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,249
0 votes
1 answer
74 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
  • 982
2 votes
2 answers
110 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,556
5 votes
0 answers
79 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
  • 426
1 vote
1 answer
87 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
121 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
1 answer
901 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
  • 721
1 vote
1 answer
71 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
99 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
  • 173
0 votes
1 answer
79 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
  • 489
0 votes
1 answer
252 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
370 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
221 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
273 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
81 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,300
1 vote
2 answers
85 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
709 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
4 votes
1 answer
930 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,572
4 votes
1 answer
803 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
4k 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
  • 313
1 vote
1 answer
172 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,862
4 votes
1 answer
741 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
116 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
  • 177
0 votes
1 answer
155 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
238 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
465 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
  • 342
0 votes
1 answer
275 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
1 vote
2 answers
685 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
  • 711
3 votes
1 answer
678 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
410 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
338 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
184 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
14 votes
3 answers
11k views

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 ...
user1394's user avatar
  • 241
3 votes
1 answer
410 views

Emacs 26 line numbers are ugly in empty buffers

I like that Emacs 26's line numbers are fast, but they seem to have a problem. If you open an empty buffer, there is an empty area which is reserved for line numbers: Once you add some text onto that ...
GDP2's user avatar
  • 1,340
0 votes
1 answer
659 views

Unable to set relative line number as a default

I am trying to setup Emacs to have relative line numbering enabled by default via this plugin. According to the readme file Relative line numbering should already be enabled by default (by ...
Ben Wainwright's user avatar
1 vote
1 answer
93 views

Number of lines the cursor is from the top of the screen when using hideshow.el

It's simple to find the number of lines from the cursor to top of the screen, eg: (- (line-number-at-pos (point)) (line-number-at-pos (window-start)))) However when the hideshow library is used to ...
ideasman42's user avatar
  • 8,556