emacs/vc: if prefix ARG, open region/line on master branch
This commit is contained in:
parent
467bd53b70
commit
d8ea65b968
1 changed files with 7 additions and 4 deletions
|
@ -15,14 +15,17 @@
|
||||||
(defvar git-link-use-commit)
|
(defvar git-link-use-commit)
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +vc/git-browse-region-or-line (&optional arg)
|
(defun +vc/git-browse-region-or-line (&optional arg)
|
||||||
"Open the website for the current version controlled file. Fallback to
|
"Open the website for the current line of this version controlled file.
|
||||||
repository root."
|
Uses the currently checked out branch. If prefix ARG, then use 'master' branch.
|
||||||
|
If an url can't be ascertained, opens the repository's root."
|
||||||
(interactive "P")
|
(interactive "P")
|
||||||
(require 'git-link)
|
(require 'git-link)
|
||||||
(let (git-link-use-commit)
|
(let ((git-link-default-branch (if arg "master" git-link-default-branch))
|
||||||
|
current-prefix-arg ; don't propagate to `git-link'
|
||||||
|
git-link-use-commit)
|
||||||
(cl-destructuring-bind (beg end)
|
(cl-destructuring-bind (beg end)
|
||||||
(if buffer-file-name (git-link--get-region))
|
(if buffer-file-name (git-link--get-region))
|
||||||
(let ((git-link-open-in-browser (not arg)))
|
(let ((git-link-open-in-browser t))
|
||||||
(git-link (git-link--select-remote) beg end)))))
|
(git-link (git-link--select-remote) beg end)))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue