Created
August 9, 2017 22:50
-
-
Save diasjorge/e3cb055b2655bacd45ea9f932a7a246c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; This buffer is for text that is not saved, and for Lisp evaluation. | |
;; To create a file, visit it with C-o and enter text in its buffer. | |
(defun magithub--url->domain (url) | |
"Tries to parse a remote url into a domain" | |
(cdr (assq 'domain (magithub--parse-url url)))) | |
(add-hook 'magit-status-mode-hook '(lambda () | |
(if (magithub-github-repository-p) | |
(let* ((remote-url (magit-get "remote" (magithub-source--remote) "url")) | |
(domain (magithub--url->domain(remote-url)))) | |
(setq ghub-base-url (concat "https://" domain "/api/v3/")) | |
)))) | |
(cdr (assq 'domain (magithub--parse-url "[email protected]:example/project.git"))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment