GNU bug report logs -
#22763
25.1.50; Feature Request -- A faster method to obtain line number at position.
Previous Next
Reported by: Keith David Bershatsky <esq <at> lawlist.com>
Date: Mon, 22 Feb 2016 02:44:01 UTC
Severity: wishlist
Tags: fixed
Found in version 25.1.50
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Eli Zaretskii <eliz <at> gnu.org> writes:
> My suggestion is instead to expose display_count_lines to Lisp via a
> simple wrapper (that would need to take care of narrowing and such
> likes, something that your proposed API doesn't do, btw).
I've now added this to Emacs 28 -- line-number-at-position. In my
tests, it makes `count-lines' about 2x faster than the previous
implementation.
Now, there's a function called `line-number-at-pos' in simple.el (that
I've amended to use `line-number-at-position', so it's even faster), and
it has almost exactly the signature that the new function has. But it
has the POS parameter optional, and it has an ABSOLUTE parameter.
I didn't actually discover it before I had finished writing the new
function, so I think I'll just extend the new function to have the same
signature, and then remove the simple.el function.
Unless somebody else has a different opinion in the next ten minutes...
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
This bug report was last modified 4 years and 57 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.