mirror of
https://github.com/magnars/multiple-cursors.el.git
synced 2026-02-04 06:12:25 +00:00
Use built-in line-number-at-pos in Emacs >= 28 (#373)
This commit is contained in:
@@ -123,18 +123,20 @@ rendered or shift text."
|
|||||||
(and (listp cursor-type)
|
(and (listp cursor-type)
|
||||||
(eq (car cursor-type) 'bar)))))
|
(eq (car cursor-type) 'bar)))))
|
||||||
|
|
||||||
(defun mc/line-number-at-pos (&optional pos absolute)
|
(if (>= emacs-major-version 28)
|
||||||
"Faster implementation of `line-number-at-pos'."
|
(defalias 'mc/line-number-at-pos #'line-number-at-pos)
|
||||||
(if pos
|
(defun mc/line-number-at-pos (&optional pos absolute)
|
||||||
(save-excursion
|
"Faster implementation of `line-number-at-pos'."
|
||||||
(if absolute
|
(if pos
|
||||||
(save-restriction
|
(save-excursion
|
||||||
(widen)
|
(if absolute
|
||||||
(goto-char pos)
|
(save-restriction
|
||||||
(string-to-number (format-mode-line "%l")))
|
(widen)
|
||||||
(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"))))
|
(goto-char pos)
|
||||||
|
(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."
|
||||||
|
|||||||
Reference in New Issue
Block a user