From 52e8d439279fe70908304e0268efcc7bdce72731 Mon Sep 17 00:00:00 2001 From: "Jose V. Trigueros" Date: Fri, 12 Aug 2022 11:15:09 -0700 Subject: [PATCH 1/3] Add defcustom to configure a path between host and filename --- browse-at-remote.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/browse-at-remote.el b/browse-at-remote.el index a7eed95..3ac24ab 100644 --- a/browse-at-remote.el +++ b/browse-at-remote.el @@ -97,6 +97,11 @@ By default is true." "List of domains where the web URL should be http." :type '(repeat string)) +(defcustom browse-at-remote-append-path-to-host nil + "Path to append at the end of the HTTP host before the filename name." + :type 'string + :group 'browse-at-remote) + (defun browse-at-remote--get-url-from-remote (remote-url) "Return (DOMAIN . URL) from REMOTE-URL." ;; If the protocol isn't specified, git treats it as an SSH URL. From e0c5652f3590630bd419ddb8538f9bb1bb9fded4 Mon Sep 17 00:00:00 2001 From: "Jose V. Trigueros" Date: Fri, 12 Aug 2022 11:15:40 -0700 Subject: [PATCH 2/3] If path is nil, default to empty string --- browse-at-remote.el | 1 + 1 file changed, 1 insertion(+) diff --git a/browse-at-remote.el b/browse-at-remote.el index 3ac24ab..3d8cfeb 100644 --- a/browse-at-remote.el +++ b/browse-at-remote.el @@ -112,6 +112,7 @@ By default is true." (port (url-port-if-non-default parsed)) (web-proto (if (equal (url-type parsed) "http") "http" "https")) + (path (or browse-at-remote-append-path-to-host "")) (filename (url-filename parsed))) ;; SSH URLs can contain colons in the host part, e.g. ssh://example.com:foo. (when (s-contains-p ":" host) From 51b83c330d3a69fe0d7e4d84887cba45e7bdebaa Mon Sep 17 00:00:00 2001 From: "Jose V. Trigueros" Date: Fri, 12 Aug 2022 11:15:59 -0700 Subject: [PATCH 3/3] Add additional path to result of get-url-from-remote --- browse-at-remote.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/browse-at-remote.el b/browse-at-remote.el index 3d8cfeb..3a65227 100644 --- a/browse-at-remote.el +++ b/browse-at-remote.el @@ -130,7 +130,7 @@ By default is true." (when port (setq host (format "%s:%d" host port))) (cons host - (format "%s://%s%s" web-proto host filename)))) + (format "%s://%s%s%s" web-proto host path filename)))) (defun browse-at-remote--remote-ref (&optional filename) "Return (REMOTE-URL . REF) which contains FILENAME.