emacs.d/bundle/bundle--magit.el

21 lines
779 B
EmacsLisp
Raw Normal View History

2021-12-15 14:20:50 +01:00
(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)))))))