From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Teemu Likonen Newsgroups: gmane.emacs.help Subject: Re: how to have line numbers start at 0? Date: Thu, 27 Aug 2009 12:37:23 +0300 Organization: A noiseless patient Spider Message-ID: <87ws4p4my4.fsf@iki.fi> References: <3c63743b-f8d2-416f-a254-c1e2a02f49e3@p36g2000prn.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1251366174 11101 80.91.229.12 (27 Aug 2009 09:42:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 27 Aug 2009 09:42:54 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Aug 27 11:42:48 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MgbVH-0000UC-0O for geh-help-gnu-emacs@m.gmane.org; Thu, 27 Aug 2009 11:42:47 +0200 Original-Received: from localhost ([127.0.0.1]:40383 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MgbVG-0008JF-9x for geh-help-gnu-emacs@m.gmane.org; Thu, 27 Aug 2009 05:42:46 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.straub-nv.de!feeder.eternal-september.org!eternal-september.org!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 20 Original-X-Trace: news.eternal-september.org U2FsdGVkX19DvyHHxGyOZm55J2hOfNNlbbspmTLthYs1OK9xZgC68+dY2tlrbI+LeQkwC+AhyjZzp7mSUeXWIS3ypB64oFWJ2RnJjaOqfR67a07P2z3NyJzHkUYt4WVhmD24ctv3K86tm5IcctXO6A== Original-X-Complaints-To: abuse@eternal-september.org Original-NNTP-Posting-Date: Thu, 27 Aug 2009 09:37:23 +0000 (UTC) X-Auth-Sender: U2FsdGVkX18p29yhD9He0EubuLJxhjLrj1YLrhQAESXQGukgTwe7GQ== Cancel-Lock: sha1:djYQZE6nCNO4KLWEwCI3/P96qPA= sha1:eN4wpBENjJMKqWGsl5UEUwUAG1I= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) Original-Xref: news.stanford.edu gnu.emacs.help:172441 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:67583 Archived-At: 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)))