2018-07-31 16:33:16 +02:00
|
|
|
;;; emacs/vc/autoload/vc.el -*- lexical-binding: t; -*-
|
2017-02-03 20:29:09 -05:00
|
|
|
|
2019-12-15 01:55:02 -05:00
|
|
|
(defun +vc--remote-homepage ()
|
2021-07-08 14:32:24 -04:00
|
|
|
(require 'browse-at-remote)
|
2019-12-15 01:55:02 -05:00
|
|
|
(or (let ((url (browse-at-remote--remote-ref)))
|
|
|
|
(cdr (browse-at-remote--get-url-from-remote (car url))))
|
|
|
|
(user-error "Can't find homepage for current project")))
|
2017-02-03 20:29:09 -05:00
|
|
|
|
2021-03-11 13:41:16 -05:00
|
|
|
(defvar browse-at-remote-prefer-symbolic)
|
|
|
|
;;;###autoload
|
|
|
|
(defun +vc/browse-at-remote (&optional arg)
|
|
|
|
"Open URL to current file (and line if selection is active) in browser.
|
|
|
|
If prefix ARG, negate the default value of `browse-at-remote-prefer-symbolic'."
|
|
|
|
(interactive "P")
|
2021-03-13 12:02:44 -05:00
|
|
|
(require 'browse-at-remote)
|
2021-11-18 19:23:55 +01:00
|
|
|
(let ((vc-ignore-dir-regexp locate-dominating-stop-dir-regexp)
|
|
|
|
(browse-at-remote-prefer-symbolic
|
2021-03-11 13:41:16 -05:00
|
|
|
(if arg
|
|
|
|
(not browse-at-remote-prefer-symbolic)
|
|
|
|
browse-at-remote-prefer-symbolic)))
|
|
|
|
(browse-at-remote)))
|
|
|
|
|
|
|
|
;;;###autoload
|
2022-10-31 18:36:18 +01:00
|
|
|
(defun +vc/browse-at-remote-kill (&optional arg interactive?)
|
2021-03-11 13:41:16 -05:00
|
|
|
"Copy URL to current file (and line if selection is active) to clipboard.
|
|
|
|
If prefix ARG, negate the default value of `browse-at-remote-prefer-symbolic'."
|
2022-10-31 18:36:18 +01:00
|
|
|
(interactive (list current-prefix-arg 'interactive))
|
2021-03-13 12:02:44 -05:00
|
|
|
(require 'browse-at-remote)
|
2021-11-18 19:23:55 +01:00
|
|
|
(let ((vc-ignore-dir-regexp locate-dominating-stop-dir-regexp)
|
|
|
|
(browse-at-remote-prefer-symbolic
|
2021-03-11 13:41:16 -05:00
|
|
|
(if arg
|
|
|
|
(not browse-at-remote-prefer-symbolic)
|
|
|
|
browse-at-remote-prefer-symbolic)))
|
2022-10-31 18:36:18 +01:00
|
|
|
(browse-at-remote-kill)
|
|
|
|
(if interactive? (message "Copied to clipboard"))))
|
2021-03-11 13:41:16 -05:00
|
|
|
|
2017-06-10 11:52:07 +02:00
|
|
|
;;;###autoload
|
2019-12-15 01:55:02 -05:00
|
|
|
(defun +vc/browse-at-remote-homepage ()
|
|
|
|
"Open homepage for current project in browser."
|
|
|
|
(interactive)
|
|
|
|
(browse-url (+vc--remote-homepage)))
|
2018-02-07 02:27:06 -05:00
|
|
|
|
2019-12-15 01:55:02 -05:00
|
|
|
;;;###autoload
|
|
|
|
(defun +vc/browse-at-remote-kill-homepage ()
|
|
|
|
"Copy homepage URL of current project to clipboard."
|
|
|
|
(interactive)
|
2019-12-25 15:21:16 -05:00
|
|
|
(let ((url (+vc--remote-homepage)))
|
|
|
|
(kill-new url)
|
|
|
|
(message "Copied to clipboard: %S" url)))
|