feature/version-control: replace browse-at-remote with git-link

This commit is contained in:
Henrik Lissner 2017-05-07 00:49:18 +02:00
parent 9d2cfc1a7e
commit ea083c91d9
4 changed files with 18 additions and 26 deletions

View file

@ -5,12 +5,11 @@
+ [-] Work-in-progress + [-] Work-in-progress
+ [X] Complete + [X] Complete
** Unreleased [52/129] ** Unreleased [53/129]
+ [1/13] Potential plugins + [2/13] Potential plugins
+ [ ] [[https://github.com/etu/webpaste.el][webpaste.el]]: sending text to bin servies (like gist, ix.io, sprunge, etc.) + [ ] [[https://github.com/etu/webpaste.el][webpaste.el]]: sending text to bin servies (like gist, ix.io, sprunge, etc.)
+ [ ] [[https://github.com/emacs-lsp/lsp-mode][lsp-mode]]: client for MS Language Server Protocol, keep an eye on this + [ ] [[https://github.com/emacs-lsp/lsp-mode][lsp-mode]]: client for MS Language Server Protocol, keep an eye on this
+ [ ] lang/javascript: [[https://github.com/codesuki/add-node-modules-path][add-node-modules-path]] (adds node_modules to ~exec-path~) + [ ] lang/javascript: [[https://github.com/codesuki/add-node-modules-path][add-node-modules-path]] (adds node_modules to ~exec-path~)
+ [ ] feature/version-control: [[https://github.com/sshaw/git-link][git-link]] (replacement for browse-at-remote)
+ [ ] lang/org: [[https://github.com/Malabarba/latex-extra][orgit]] (org links to magit buffers) + [ ] lang/org: [[https://github.com/Malabarba/latex-extra][orgit]] (org links to magit buffers)
+ [ ] lang/org: [[https://github.com/jkitchin/org-ref][org-ref]] (bibtex/citation helper) + [ ] lang/org: [[https://github.com/jkitchin/org-ref][org-ref]] (bibtex/citation helper)
+ [ ] lang/org: [[https://github.com/tashrifsanil/org-easy-img-insert][org-easy-img-insert]] + [ ] lang/org: [[https://github.com/tashrifsanil/org-easy-img-insert][org-easy-img-insert]]
@ -20,6 +19,7 @@
+ [ ] lang/python: [[https://github.com/Wilfred/pyimport][pyimport]] + [ ] lang/python: [[https://github.com/Wilfred/pyimport][pyimport]]
+ [ ] An image plugin for zooming images at point + [ ] An image plugin for zooming images at point
+ https://github.com/mhayashi1120/Emacs-imagex ? + https://github.com/mhayashi1120/Emacs-imagex ?
+ [X] feature/version-control: [[https://github.com/sshaw/git-link][git-link]] (replacement for browse-at-remote)
+ [X] feature/version-control: [[https://github.com/pidu/git-timemachine][git-timemachine]] (replacement for vc-annotate) + [X] feature/version-control: [[https://github.com/pidu/git-timemachine][git-timemachine]] (replacement for vc-annotate)
+ [0/4] New modules + [0/4] New modules
+ [ ] app/finance (maybe settle for org-mode tables?) + [ ] app/finance (maybe settle for org-mode tables?)

View file

@ -13,6 +13,7 @@
:commands git-gutter-mode :commands git-gutter-mode
:init :init
(defun +version-control|git-gutter-maybe () (defun +version-control|git-gutter-maybe ()
"Enable `git-gutter-mode' in non-remote buffers."
(when (and (buffer-file-name) (when (and (buffer-file-name)
(not (file-remote-p (buffer-file-name)))) (not (file-remote-p (buffer-file-name))))
(git-gutter-mode +1))) (git-gutter-mode +1)))
@ -28,15 +29,11 @@
(advice-add #'evil-force-normal-state :after #'git-gutter))) (advice-add #'evil-force-normal-state :after #'git-gutter)))
(def-package! browse-at-remote
:commands (browse-at-remote browse-at-remote-get-url))
(def-package! git-timemachine (def-package! git-timemachine
:commands (git-timemachine git-timemachine-toggle) :commands (git-timemachine git-timemachine-toggle)
:config :config
(require 'magit-blame) (require 'magit-blame)
;; Sometimes I forget `git-timemachine' is enabled in a buffer, so instead of ;; Sometimes I forget `git-timemachine' is enabled in a buffer, so instead of
;; showing revision details in the minibuffer, show them in ;; showing revision details in the minibuffer, show them in
;; `header-line-format', which is always visible. ;; `header-line-format', which is always visible.
@ -86,6 +83,10 @@
:nv "C-k" nil)) :nv "C-k" nil))
(def-package! git-link
:commands (git-link git-link-commit git-link-homepage))
(def-package! evil-magit (def-package! evil-magit
:when (featurep! :feature evil) :when (featurep! :feature evil)
:after magit) :after magit)

View file

@ -3,29 +3,20 @@
;;;###autoload ;;;###autoload
(defun +vcs-root () (defun +vcs-root ()
"Get git url root." "Get git url root."
(when-let (url (car-safe (browse-at-remote--remote-ref buffer-file-name))) (let ((remote (git-link--select-remote)))
(cdr (browse-at-remote--get-url-from-remote url)))) (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 ;;;###autoload
(defun +vcs/git-browse () (defun +vcs/git-browse ()
"Open the website for the current version controlled file. Fallback to "Open the website for the current version controlled file. Fallback to
repository root." repository root."
(interactive) (interactive)
(let (url) (let ((git-link-open-in-browser t))
(condition-case err (call-interactively 'git-link)))
(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))))
;;;###autoload ;;;###autoload
(defun +vcs/git-browse-issues () (defun +vcs/git-browse-issues ()

View file

@ -5,8 +5,8 @@
;; n/a ;; n/a
;;; +git ;;; +git
(package! browse-at-remote)
(package! git-gutter-fringe) (package! git-gutter-fringe)
(package! git-link)
(package! git-timemachine) (package! git-timemachine)
(package! gitconfig-mode) (package! gitconfig-mode)
(package! gitignore-mode) (package! gitignore-mode)