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
+ [X] Complete
** Unreleased [52/129]
+ [1/13] Potential plugins
** Unreleased [53/129]
+ [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/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~)
+ [ ] 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/jkitchin/org-ref][org-ref]] (bibtex/citation helper)
+ [ ] 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]]
+ [ ] An image plugin for zooming images at point
+ 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)
+ [0/4] New modules
+ [ ] app/finance (maybe settle for org-mode tables?)

View file

@ -13,6 +13,7 @@
:commands git-gutter-mode
:init
(defun +version-control|git-gutter-maybe ()
"Enable `git-gutter-mode' in non-remote buffers."
(when (and (buffer-file-name)
(not (file-remote-p (buffer-file-name))))
(git-gutter-mode +1)))
@ -28,10 +29,6 @@
(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
:commands (git-timemachine git-timemachine-toggle)
:config
@ -86,6 +83,10 @@
:nv "C-k" nil))
(def-package! git-link
:commands (git-link git-link-commit git-link-homepage))
(def-package! evil-magit
:when (featurep! :feature evil)
:after magit)

View file

@ -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 ()

View file

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