Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I know that there's already a question of the same type on here, and I did take a look at it. The thing is, what is suggested there leads to line numbers being displayed right next to the code, with not a single space in between which annoys me a lot. Therefore, I wanted to try a different approach.

I'm trying to use the this code I found on the emacs wiki. I created the line-num.el file , put it in ~/.emacs.d/plugins and then modified the ~/.emacs file as follows:

(add-to-list 'load-path"~/.emacs.d/plugins")

(require 'line-num.el)

But when I start emacs, I don't see any line numbers.

share|improve this question
    
I don't know what the problem is, but seen this page? emacswiki.org/emacs/LineNumbers It lists several packages with discussion. –  Tom Oct 15 '11 at 20:03

2 Answers 2

You could use linum-mode's linum-format variable to add a space on the margin: (setq linum-format "%d ")

share|improve this answer

A couple of things. First, to properly require the package, you don't use the .el at the end:

(require 'line-num)

Second, you need to turn it on, generally by using a hook:

(add-hook 'c++-mode-hook 'turn-on-line-numbers-display)

Add a line for each of the programming modes you want to have line numbers.

That said, the line-num package says that the setnu package provides better functionality, so you might want to try that, as well as the setnu+ addition. See the wiki for how to get it and install it.

And, there's the built-in linum-mode that you found. To turn that on for all buffers associated with files, you can do:

(add-hook 'find-file-hook 'linum-on)
share|improve this answer
    
I managed to use the built in line number module linum-mode, but I wanted to modify the .emacs file so that that command is run on startup. Could you tell me how to do that? Thanks! –  efficiencyIsBliss Oct 25 '11 at 0:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.