mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
emacs/vc: if prefix ARG, open region/line on master branch
This commit is contained in:
@ -15,14 +15,17 @@
|
||||
(defvar git-link-use-commit)
|
||||
;;;###autoload
|
||||
(defun +vc/git-browse-region-or-line (&optional arg)
|
||||
"Open the website for the current version controlled file. Fallback to
|
||||
repository root."
|
||||
"Open the website for the current line of this version controlled file.
|
||||
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")
|
||||
(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)
|
||||
(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)))))
|
||||
|
||||
;;;###autoload
|
||||
|
Reference in New Issue
Block a user