20 lines
779 B
EmacsLisp
20 lines
779 B
EmacsLisp
(use-package magit)
|
|
(global-set-key (kbd "C-x g") 'magit-status)
|
|
(global-set-key (kbd "C-x M-g") 'magit-dispatch)
|
|
(defun jnf/magit-browse-pull-request ()
|
|
"In `magit-log-mode', open the associated pull request at point."
|
|
(interactive)
|
|
(let* ((remote-url
|
|
(car
|
|
(git-link--exec "remote" "get-url"
|
|
(format "%s" (magit-get-current-remote)))))
|
|
(beg (line-beginning-position))
|
|
(end (line-end-position))
|
|
(region (buffer-substring-no-properties beg end)))
|
|
(save-match-data
|
|
(and (string-match "(\\#\\([0-9]+\\))$" region)
|
|
(browse-url-default-macosx-browser
|
|
(concat
|
|
(s-replace ".git" "" remote-url)
|
|
"/pull/"
|
|
(match-string 1 region)))))))
|