git-link icon indicating copy to clipboard operation
git-link copied to clipboard

support for http

Open drdv opened this issue 2 years ago • 2 comments

Sometimes I need to have http instead of https in the links. Currently I deal with this using

(use-package git-link
  :ensure t
  :bind ("C-c g l" . git-link)
  :config
  (setq git-link-open-in-browser t)
  (defun git-link--http-advice (func link)
    (funcall func (replace-regexp-in-string "^https:" "http:" link)))
  (defun git-link-toggle-http-advice ()
    "Toggle using http or https by advicing `git-link--new'."
    (interactive)
    (if (advice--p (advice--symbol-function 'git-link--new))
	(advice-remove 'git-link--new 'git-link--http-advice)
      (advice-add 'git-link--new :around 'git-link--http-advice)))
  (git-link-toggle-http-advice))

But clearly there is a better way to deal with this. It seems to me that it is trivial to support this in the code (e.g., by adding a variable instead of hard-coding https in the links).

drdv avatar Nov 25 '23 20:11 drdv

What services do you need to link to using http?

sshaw avatar Nov 26 '23 08:11 sshaw

self-hosted gitlab

drdv avatar Nov 26 '23 11:11 drdv