feature/version-control: replace browse-at-remote with git-link
This commit is contained in:
parent
9d2cfc1a7e
commit
ea083c91d9
4 changed files with 18 additions and 26 deletions
|
@ -3,29 +3,20 @@
|
|||
;;;###autoload
|
||||
(defun +vcs-root ()
|
||||
"Get git url root."
|
||||
(when-let (url (car-safe (browse-at-remote--remote-ref buffer-file-name)))
|
||||
(cdr (browse-at-remote--get-url-from-remote url))))
|
||||
(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))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +vcs/git-browse ()
|
||||
"Open the website for the current version controlled file. Fallback to
|
||||
repository root."
|
||||
(interactive)
|
||||
(let (url)
|
||||
(condition-case err
|
||||
(setq url (browse-at-remote-get-url))
|
||||
('error
|
||||
(setq url (shell-command-to-string "hub browse -u --"))
|
||||
(setq url (if url
|
||||
(concat (string-trim url) "/blob/"
|
||||
(or (car (vc-git-branches)) "master") "/"
|
||||
(file-relative-name (file-truename (buffer-file-name))
|
||||
(file-truename (doom-project-root)))
|
||||
(when (use-region-p)
|
||||
(format "#L%s-L%s"
|
||||
(line-number-at-pos (region-beginning))
|
||||
(line-number-at-pos (region-end)))))))))
|
||||
(when url (browse-url url))))
|
||||
(let ((git-link-open-in-browser t))
|
||||
(call-interactively 'git-link)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +vcs/git-browse-issues ()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue