1

I need your help cause I couldn't figure it out. My ideal linum format has 5 digits at least. I'd really like to scale the linum font size down with respect to the text, say by 1/3. This is great cause it avoids an excessively wide linum column (especially in a split view of 2 frames).

However, if I fix the linum height to be 80 for instance, emacs adds a gap between the left margin and the fringe, which defeats the whole idea of scaling it down.

In linum-mode the left margin is fixed, so manually setting left-margin-width doesn't help.

After many tries I came to the conclusion that it cannot be done with my poor level of understanding of lisp and how emacs handles the display. Below is an example.

enter image description here

Is it possible to have different linum and text font size, but avoiding that gap?

@Stefan: Thanks! emacs 24.5 / Debian Stretch. I am not incline to update emacs for now if possible, but I will try nlinum-mode (although I read linum should be more efficient).

@Stefan: sorry my bad: "[nlinum] should usually be about as fast or faster than linum.el". That sounds great, thanks! I am slightly concerned about a problem found with the deamon “ERROR: Invalid face: linum”. But I'll definitely give it a try - I wasn't aware you were directly involved in dev this, well thanks twice then.

  • 1
    Line-number display has changed significantly over the last few years. So you'll want to clarify which version of Emacs you're using, and you'll probably want to try nlinum-mode (from GNU ELPA) as well display-line-numbers-mode (in Emacs≥26) which each have slightly different strengths and weaknesses. – Stefan Nov 7 '19 at 3:34
  • Not sure where you got the idea that linum should be more efficient than nlinum (since efficiency was one of the main motivating factor behind my development of nlinum), but in any case you might like to try nlinum since includes some enhancements w.r.t correctly sizing the margin area (linum also has those enhancements in recent Emacsen, IIRC, but nlinum being a GNU ELPA package lets you benefit from them without having to upgrade your Emacs). – Stefan Nov 7 '19 at 13:10
  • As of Emacs 26, line number generation is built-in to the display engine that is written in C. Using the Lisp versions such as linum.el or nlinum.el would only make sense for people who cannot upgrade their Emacs versions. The built-in version written in C does not use the display margin; instead, it uses the text area to the right of the fringe and there is only one space on each side of them. [Or, visa versa if using a language that reads from right to left.] – lawlist Nov 7 '19 at 17:12
  • @Stefan: nlinum did it on Emacs 24.5. To be fair, there still is a minimal gap, but is way smaller. Line numbers smaller than the text looks beautiful! Thanks – desmogix Nov 7 '19 at 23:08
0

Turns out, nlinum-mode doesn't suffer the same gap issue as described in the question. Emacsclient won't work, workaround at the link.

| improve this answer | |

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.