瀏覽代碼

Add my-magit-messenger

master
10sr 5 年之前
父節點
當前提交
624c03e2c1
簽署人: 10sr GPG Key ID: 7BEC428194130EB2
共有 1 個文件被更改,包括 32 次插入0 次删除
  1. +32
    -0
      emacs.el

+ 32
- 0
emacs.el 查看文件

@@ -1162,6 +1162,38 @@ found, otherwise returns nil."
(set-face-background 'magit-diff-lines-boundary "blue")
)

(defun my-magit-messenger (file line)
"Magit messenger."
(interactive (list buffer-file-name
(line-number-at-pos)))
(cl-assert file)
(cl-assert line)
(let* ((blame-args '("-w"))
(id (with-temp-buffer
(let ((exit (apply 'call-process
"git" ;; PROGRAM
nil ;; INFILE
t ;; DESTINATION
nil ;; DISPLAY
"--no-pager" ;; ARGS
"blame"
"-L"
(format "%d,+1" line)
"--porcelain"
file
blame-args
)))
(goto-char (point-min))
(cl-assert (eq exit 0)
"Failed: %s" (buffer-substring (point)
(point-at-eol)))
(save-match-data
(re-search-forward (rx buffer-start
(one-or-more hex-digit)))
(match-string 0))))))
(magit-show-commit id)))


(when (boundp 'git-rebase-filename-regexp)
(add-to-list 'auto-mode-alist
`(,git-rebase-filename-regexp . text-mode)))


Loading…
取消
儲存