git.fiddlerwoaroof.com
Browse code

feat(emacs): implement browse-at-remote support for gitlist

Edward authored on 20/12/2021 19:42:00
Showing 1 changed files
... ...
@@ -241,10 +241,22 @@
241 241
               'fwoar/propertize-magit-log))
242 242
 
243 243
 (use-package browse-at-remote
244
-  :after magit
245 244
   :ensure t
246
-  :config)
245
+  :custom
246
+  (browse-at-remote-prefer-symbolic nil)
247 247
 
248
+  :config
249
+  (cl-pushnew '("git.fiddlerwoaroof.com$" . "gitlist")
250
+              browse-at-remote-remote-type-regexps
251
+              :test 'equal)
252
+
253
+  (defun browse-at-remote--format-region-url-as-gitlist
254
+      (repo-url ref relname start-line end-line)
255
+    (unless (s-ends-with-p ".git" repo-url)
256
+      (setf repo-url (format "%s.git" repo-url)))
257
+    ;; gitlist doesn't support end-line
258
+    (format "%s/blob/%s/%s#L%s" repo-url ref relname start-line))
259
+  )
248 260
 (load-package-configuration 'evil)
249 261
 (load-package-configuration 'helm)
250 262
 (load-package-configuration 'projectile)