Use built-in line-number-at-pos in Emacs >= 28 (#373)

This commit is contained in:
Renato Ferreira
2026-01-08 06:09:20 -03:00
committed by GitHub
parent 9017f3be6b
commit 2cd802b1f7

View File

@@ -123,6 +123,8 @@ rendered or shift text."
(and (listp cursor-type) (and (listp cursor-type)
(eq (car cursor-type) 'bar))))) (eq (car cursor-type) 'bar)))))
(if (>= emacs-major-version 28)
(defalias 'mc/line-number-at-pos #'line-number-at-pos)
(defun mc/line-number-at-pos (&optional pos absolute) (defun mc/line-number-at-pos (&optional pos absolute)
"Faster implementation of `line-number-at-pos'." "Faster implementation of `line-number-at-pos'."
(if pos (if pos
@@ -134,7 +136,7 @@ rendered or shift text."
(string-to-number (format-mode-line "%l"))) (string-to-number (format-mode-line "%l")))
(goto-char pos) (goto-char pos)
(string-to-number (format-mode-line "%l")))) (string-to-number (format-mode-line "%l"))))
(string-to-number (format-mode-line "%l")))) (string-to-number (format-mode-line "%l")))))
(defun mc/make-cursor-overlay-at-eol (pos) (defun mc/make-cursor-overlay-at-eol (pos)
"Create overlay to look like cursor at end of line." "Create overlay to look like cursor at end of line."