2017-06-08 11:47:56 +02:00
|
|
|
;;; feature/version-control/autoload.el -*- lexical-binding: t; -*-
|
2017-02-03 20:29:09 -05:00
|
|
|
|
|
|
|
;;;###autoload
|
2017-02-11 06:51:59 -05:00
|
|
|
(defun +vcs-root ()
|
2017-02-03 20:29:09 -05:00
|
|
|
"Get git url root."
|
2017-05-07 00:49:18 +02:00
|
|
|
(let ((remote (git-link--select-remote)))
|
|
|
|
(if (git-link--remote-host remote)
|
|
|
|
(format "https://%s/%s"
|
|
|
|
(git-link--remote-host remote)
|
|
|
|
(git-link--remote-dir remote))
|
|
|
|
(error "Remote `%s' is unknown or contains an unsupported URL" remote))))
|
2017-02-03 20:29:09 -05:00
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun +vcs/git-browse ()
|
2017-04-22 21:27:54 -04:00
|
|
|
"Open the website for the current version controlled file. Fallback to
|
|
|
|
repository root."
|
2017-02-03 20:29:09 -05:00
|
|
|
(interactive)
|
2017-06-09 13:59:23 +02:00
|
|
|
(require 'git-link)
|
|
|
|
(destructuring-bind (beg end)
|
|
|
|
(if buffer-file-name (git-link--get-region))
|
|
|
|
(let ((git-link-open-in-browser t))
|
|
|
|
(git-link (git-link--select-remote) beg end))))
|
2017-02-03 20:29:09 -05:00
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun +vcs/git-browse-issues ()
|
|
|
|
"Open the github issues page for current repo."
|
|
|
|
(interactive)
|
2017-02-11 06:51:59 -05:00
|
|
|
(if-let (root (+vcs-root))
|
2017-02-03 20:29:09 -05:00
|
|
|
(browse-url (concat root "/issues"))
|
|
|
|
(user-error "No git root found!")))
|