all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Efficiently getting the line at point
@ 2009-09-18 14:30 Nordlöw
  2009-09-18 15:02 ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: Nordlöw @ 2009-09-18 14:30 UTC (permalink / raw)
  To: help-gnu-emacs

How do I efficiently get the current line at a given position?

Is line-number-at-pos() the best candidate?
This function in turn calls count-lines().
Why? --- I thought Emacs had an internal O(1) lookup table for the
positions of line beginnings of a buffer or file.

Thanks in advance,
Per Nordlöw


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Efficiently getting the line at point
  2009-09-18 14:30 Efficiently getting the line at point Nordlöw
@ 2009-09-18 15:02 ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2009-09-18 15:02 UTC (permalink / raw)
  To: help-gnu-emacs

> From: =?ISO-8859-1?Q?Nordl=F6w?= <per.nordlow@gmail.com>
> Date: Fri, 18 Sep 2009 07:30:19 -0700 (PDT)
> 
> I thought Emacs had an internal O(1) lookup table for the positions
> of line beginnings of a buffer or file.

It doesn't.  line-number-at-pos is what you are looking for.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-09-18 15:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-18 14:30 Efficiently getting the line at point Nordlöw
2009-09-18 15:02 ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.