From 5802bd7047f2e63852fee1804445490a1b2887aa Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 11 Jan 2020 17:29:16 -0500 Subject: [PATCH] Refactor browse-at-remote commands --- modules/emacs/vc/autoload/vc.el | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/emacs/vc/autoload/vc.el b/modules/emacs/vc/autoload/vc.el index 9bf08402f..4b26f41b4 100644 --- a/modules/emacs/vc/autoload/vc.el +++ b/modules/emacs/vc/autoload/vc.el @@ -3,15 +3,18 @@ (autoload 'browse-at-remote-get-url "browse-at-remote") (autoload 'browse-at-remote--file-url "browse-at-remote") +(defun +vc--remote-file-or-region-link () + (if (or (doom-region-active-p) (not buffer-file-name)) + (browse-at-remote-get-url) + (browse-at-remote--file-url (buffer-file-name)))) + ;;;###autoload (defun +vc/browse-at-remote-file-or-region () "Open the current file at remote in your browser. If a selection is active, highlight them. Otherwise omits the #L suffix in the URL." (interactive) - (if (or (doom-region-active-p) (not buffer-file-name)) - (browse-at-remote) - (browse-url (browse-at-remote--file-url (buffer-file-name))))) + (browse-url (+vc--remote-file-or-region-link))) ;;;###autoload (defun +vc/browse-at-remote-kill-file-or-region () @@ -19,10 +22,7 @@ the URL." If a selection is active, highlight them. Otherwise omits the #L suffix in the URL." (interactive) - (let ((url - (if (or (doom-region-active-p) (not buffer-file-name)) - (browse-at-remote-get-url) - (browse-at-remote--file-url (buffer-file-name))))) + (let ((url (+vc--remote-file-or-region-link))) (kill-new url) (message "Copied to clipboard: %S" url)))