Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EMACS :: linum-mode and size of font (unreadable line numbers)

Tags:

When using linum-mode in emacs and when increase font by M-x text-scale-increase, there is the one thing that bothers me. Font for line numbers have same size as reading and don't fit into left-margin on left side of buffer!

1 Normal font-size, OKEverything works as should be

2 Increased font-size, no longer readable FUUUUUenter image description here


What I'd really like to have:

When increase/decrease font I want one of these to work

  1. then increase/decrease width of left-margin (resp. left-fringe) accordingly
  2. then don't change font for left-margin but increase/decrease spacing between line numbers

    Does anybody have some suggestions? Thanks, guys

like image 270
DinGODzilla Avatar asked Feb 16 '12 01:02

DinGODzilla


People also ask

How to display line numbers in Emacs?

By default, Emacs displays the current line number of the point in the mode line. You can toggle this feature off or on with the command M-x line-number-mode , or by setting the variable line-number-mode .

How do I change the font size in emacs?

You can press C-x C-+ and C-x C-- to increase or decrease the buffer text size.

How do I reduce font size in emacs?

Vanilla Emacs: You can use ` C-x C-+ ' and 'C-x C--' ( 'text-scale-adjust' ) to increase or decrease the buffer text size (` C-+ ' or 'C--' to repeat). To restore the default (global) face height, type 'C-x C-0' .


2 Answers

Have a look at these two links:

  1. my question on the same issue
  2. my workaround for this issue

It works quite well enough for my needs.

Examples:

enter image description here 1 enter image description here

like image 122
Peter.O Avatar answered Oct 26 '22 02:10

Peter.O


The easiest, most straightforward solution I've seen is to set the line numbers to a fixed height. This can be accomplished easily, in accordance with user78810's answer: https://unix.stackexchange.com/questions/29786/font-size-issues-with-emacs-in-linum-mode/146781#146781

To wit, add the following line in your emacs config (or to your dotspacemacs/user-config function, if you're using spacemacs):

(eval-after-load "linum"   '(set-face-attribute 'linum nil :height 100)) 
like image 22
Shon Avatar answered Oct 26 '22 01:10

Shon