[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#22763: 25.1.50; Feature Request -- A faster method to obtain line nu
From: |
Lars Ingebrigtsen |
Subject: |
bug#22763: 25.1.50; Feature Request -- A faster method to obtain line number at position. |
Date: |
Sun, 07 Feb 2021 16:07:21 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Eli Zaretskii <eliz@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
- bug#22763: 25.1.50; Feature Request -- A faster method to obtain line number at position.,
Lars Ingebrigtsen <=
- bug#22763: 25.1.50; Feature Request -- A faster method to obtain line number at position., Lars Ingebrigtsen, 2021/02/07
- bug#22763: 25.1.50; Feature Request -- A faster method to obtain line number at position., Lars Ingebrigtsen, 2021/02/07
- bug#22763: 25.1.50; Feature Request -- A faster method to obtain line number at position., Stefan Monnier, 2021/02/07
- bug#22763: 25.1.50; Feature Request -- A faster method to obtain line number at position., Lars Ingebrigtsen, 2021/02/07
- bug#22763: 25.1.50; Feature Request -- A faster method to obtain line number at position., Lars Ingebrigtsen, 2021/02/07
- bug#22763: 25.1.50; Feature Request -- A faster method to obtain line number at position., Eli Zaretskii, 2021/02/07
- bug#22763: 25.1.50; Feature Request -- A faster method to obtain line number at position., Lars Ingebrigtsen, 2021/02/07
- bug#22763: 25.1.50; Feature Request -- A faster method to obtain line number at position., Lars Ingebrigtsen, 2021/02/07
- bug#22763: 25.1.50; Feature Request -- A faster method to obtain line number at position., Eli Zaretskii, 2021/02/07
- bug#22763: 25.1.50; Feature Request -- A faster method to obtain line number at position., Eli Zaretskii, 2021/02/07