This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun eye--get-region-line-number () | |
"获取选中区域开始行号和结束行号。 | |
参考:https://emacs.stackexchange.com/questions/62023/how-to-get-the-real-line-number-of-a-selection" | |
(let* ((rend (region-end)) | |
(startl (line-number-at-pos (region-beginning))) | |
(endl (line-number-at-pos rend)) | |
(real-endl (if (= rend (save-excursion (goto-char rend) (beginning-of-line) (point))) | |
(- endl 1) | |
endl))) | |
(cons startl real-endl) |