feature/version-control: fix +vcs/git-browse{,-issues} commands

This commit is contained in:
Henrik Lissner 2017-04-22 21:27:54 -04:00
parent 369ab487e9
commit 0e8ee249ac
3 changed files with 10 additions and 8 deletions

View file

@ -1,6 +1,6 @@
#+TITLE: DOOM Emacs Changelog
** Unreleased [35/47]
** Unreleased [36/48]
+ [-] app/finance
+ [-] app/crm
+ [-] Improve send-to-REPL workflow
@ -12,6 +12,7 @@
+ [ ] New (tools/upload): add ~+upload/open-remote-file~ command
+ [ ] Fix 0/0 modeline display (caused by leftover anzu state)
+ [ ] Fix snippet-mode detection in snippets
+ [X] Fix ~+vcs/git-browse~ & ~+vcs/git-browse-issues~
+ [7/9] lang/org
+ [ ] Add bootstrap to install latex tools :new:
+ [ ] test inline latex preview support :bug:

View file

@ -29,7 +29,7 @@
(def-package! browse-at-remote
:commands (browse-at-remote/browse browse-at-remote/get-url))
:commands (browse-at-remote browse-at-remote-get-url))
(def-package! magit

View file

@ -8,18 +8,19 @@
;;;###autoload
(defun +vcs/git-browse ()
"Open the website for the current (or specified) version controlled FILE.
Fallback to repository root."
"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
('error
(setq url (shell-command-to-string "hub browse -u --"))
(setq url (if url
(concat (string-trim url) "/"
(file-relative-name (buffer-file-name)
(doom-project-root))
(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))