help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Does Emacs have a line-number function or is %l the only equivalent?


From: Kevin Rodgers
Subject: Re: Does Emacs have a line-number function or is %l the only equivalent?
Date: Thu, 15 Jan 2004 09:07:49 -0700
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2

Christopher J. White wrote:

"chris" == Christian Seberino <seberino@spawar.navy.mil> writes:


chris> I just wanted a function that returned the line number of
chris> current point that I could use anywhere.

How about (what-line)?

As its doc string says, it prints the line number (and more) in the echo

area.  Better is (count-lines (point-min) (point)), which actually returns
a number.  And if you want to ignore any narrowing that may be in effect,
you need to do

(save-restriction
  (widen)
  (count-lines (point-min) (point)))

--
Kevin Rodgers



reply via email to

[Prev in Thread] Current Thread [Next in Thread]