I have list of buffer positions and I want to get the numbers of the lines at those positions. Is there a better way to do that then using
get-thing-at-point 'line? I want the code to be as fast as possible.
For a faster method to get line number at position --
(with-current-buffer BUFFER (goto-char POSITION) (string-to-number (format-mode-line "%l"))) -- see the following thread, which cites some limitations / disadvantages in the comments:
The traditional method is to use
line-number-at-pos, which is a compiled Lisp function in
(line-number-at-pos &optional POS ABSOLUTE) Return buffer line number at position POS. If POS is nil, use current buffer location. If ABSOLUTE is nil, the default, counting starts at (point-min), so the value refers to the contents of the accessible portion of the (potentially narrowed) buffer. If ABSOLUTE is non-nil, ignore any narrowing and return the absolute line number.