I have seen posts on the topic of getting "??" in the modeline instead of the line number. However despite my best efforts I can't get rid of the problem.

I have put those settings in my config:

  (setq line-number-display-limit nil)
  (setq line-number-display-limit-width most-positive-fixnum)

I'm pretty sure they help, sometimes now it's OK. But at least half of the time it's not. It's funny, I made myself a test file and it's kind of randomly working or not...

I'm using spacemacs and put my config on github.

By the way, this is the relevant code in spacemacs if that helps...

  • I've set it to a lower value meanwhile which ironically seems to work better than the previous approach of using the highest possible one. – wasamasa Apr 21 '15 at 16:05
  • indeed by setting it at 250.000 now my test file works every time! if you make an answer, i'll award you the answer. I hope it won't come back though... – Emmanuel Touzery Apr 21 '15 at 16:28
  • I think I'll try figuring out why that works first and then answer, no matter the outcome. – wasamasa Apr 21 '15 at 16:46
  • I'm ok with closing that question and putting all the info in the other question (which I reference in my question). – Emmanuel Touzery Apr 21 '15 at 17:40

I did replace the value of line-number-display-limit-width with something substantially smaller eventually and that fixed the issue for me. Judging by the code in xdisp.c Emacs is using a heuristics that involves multiplying line-number-display-limit-width with the window height times two plus thirty. Doing that on most-positive-fixnum will overflow into a negative number and probably makes the heuristics fail.

Assuming the worst case with a 32bit system (where most-positive-fixnum is 2^29-1) and with 85 lines of text, a safe value should be (2^29-1)/(2*85+30) = 2684354 or lower. So, try the following instead (and keep line-number-display-limit as is):

(setq line-number-display-limit-width 2000000)

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