Skip to content

Instantly share code, notes, and snippets.

View owensys's full-sized avatar

owensys owensys

View GitHub Profile
@owensys
owensys / git-blame.el
Last active December 13, 2021 15:24
git operation function
(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)