[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how to have line numbers start at 0?
From: |
Xah Lee |
Subject: |
Re: how to have line numbers start at 0? |
Date: |
Thu, 27 Aug 2009 05:14:20 -0700 (PDT) |
User-agent: |
G2/1.0 |
On Aug 27, 2:37 am, Teemu Likonen <tliko...@iki.fi> wrote:
> On 2009-08-27 02:25 (-0700), Xah Lee wrote:
>
> > with emacs 23, is it possible to have line numbers on the margin start
> > at 0?
>
> Do you mean like this:
>
> (setq linum-format #'(lambda (number)
> (format "%3d" (1- number))))
>
> Or with dynamic width:
>
> (setq linum-format #'my-linum-format)
>
> (defun my-linum-format (number)
> (format
> (let ((w (length (number-to-string
> (count-lines (point-min) (point-max))))))
> (concat "%" (number-to-string w) "d"))
> (1- number)))
Thanks. :)
Xah