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

View file

@ -29,7 +29,7 @@
(def-package! browse-at-remote (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 (def-package! magit

View file

@ -8,18 +8,19 @@
;;;###autoload ;;;###autoload
(defun +vcs/git-browse () (defun +vcs/git-browse ()
"Open the website for the current (or specified) version controlled FILE. "Open the website for the current version controlled file. Fallback to
Fallback to repository root." repository root."
(interactive) (interactive)
(let (url) (let (url)
(condition-case err (condition-case err
(setq url (browse-at-remote-get-url)) (setq url (browse-at-remote-get-url))
(error ('error
(setq url (shell-command-to-string "hub browse -u --")) (setq url (shell-command-to-string "hub browse -u --"))
(setq url (if url (setq url (if url
(concat (string-trim url) "/" (concat (string-trim url) "/blob/"
(file-relative-name (buffer-file-name) (or (car (vc-git-branches)) "master") "/"
(doom-project-root)) (file-relative-name (file-truename (buffer-file-name))
(file-truename (doom-project-root)))
(when (use-region-p) (when (use-region-p)
(format "#L%s-L%s" (format "#L%s-L%s"
(line-number-at-pos (region-beginning)) (line-number-at-pos (region-beginning))