all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
blob b90017fdb4346558ee5dc4d4fc1b8d823b390957 2113 bytes (raw)
name: gnu/packages/patches/emacs-browse-at-remote-gnu-add-support-for-gnu-repositories.patch 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
 
Copyright © 2018 Oleg Pykhalov <go.wigust@gmail.com>

This patch adds a support for Git repositories hosted on git.savannah.gnu.org.

Upstream bug URL:

https://github.com/rmuslimov/browse-at-remote/pull/46

From cd2ccdaef8b1d97337d790175f71cc3dbcfcff64 Mon Sep 17 00:00:00 2001
From: Oleg Pykhalov <go.wigust@gmail.com>
Date: Fri, 26 Jan 2018 00:05:30 +0300
Subject: [PATCH] Add support for repositories that are hosted on gnu cgit

---
 browse-at-remote.el | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/browse-at-remote.el b/browse-at-remote.el
index 66967b3..e210d18 100644
--- a/browse-at-remote.el
+++ b/browse-at-remote.el
@@ -44,7 +44,8 @@
 (defcustom browse-at-remote-remote-type-domains
   '(("bitbucket.org" ."bitbucket")
     ("github.com" . "github")
-    ("gitlab.com" . "gitlab"))
+    ("gitlab.com" . "gitlab")
+    ("git.savannah.gnu.org" . "gnu"))
   "Alist of domain patterns to remote types."
 
   :type '(alist :key-type (string :tag "Domain")
@@ -199,6 +200,24 @@ If HEAD is detached, return nil."
     (if (fboundp formatter)
         formatter nil)))
 
+(defun browse-at-remote-gnu-format-url (repo-url)
+  "Get a gnu formatted URL."
+  (replace-regexp-in-string
+   (concat "https://" (car (rassoc "gnu" browse-at-remote-remote-type-domains))
+           "/\\(git\\).*\\'")
+   "cgit" repo-url nil nil 1))
+
+(defun browse-at-remote--format-region-url-as-gnu (repo-url location filename &optional linestart lineend)
+  "URL formatter for gnu."
+  (let ((repo-url (browse-at-remote-gnu-format-url repo-url)))
+    (cond
+     (linestart (format "%s.git/tree/%s?h=%s#n%d" repo-url filename location linestart))
+     (t (format "%s.git/tree/%s?h=%s" repo-url filename location)))))
+
+(defun browse-at-remote--format-commit-url-as-gnu (repo-url commithash)
+  "Commit URL formatted for gnu"
+  (format "%s.git/commit/?id=%s" (browse-at-remote-gnu-format-url repo-url) commithash))
+
 (defun browse-at-remote--format-region-url-as-github (repo-url location filename &optional linestart lineend)
   "URL formatted for github."
   (cond
-- 
2.15.1


debug log:

solving b90017fdb ...
found b90017fdb in https://git.savannah.gnu.org/cgit/guix.git

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.