diff options
author | Stefan Kangas <stefan@marxist.se> | 2021-09-26 14:29:41 +0200 |
---|---|---|
committer | Stefan Kangas <stefan@marxist.se> | 2021-09-26 14:55:19 +0200 |
commit | 8ea1765fea35e68189ba5edca74d61660950ee8b (patch) | |
tree | 0f5c22c2007636d82153af1041a3523284211d9c /lisp/emacs-lisp | |
parent | a0d5de4fb9de82dfda741c5cf39d87cee955cc46 (diff) | |
download | emacs-8ea1765fea35e68189ba5edca74d61660950ee8b.tar.gz emacs-8ea1765fea35e68189ba5edca74d61660950ee8b.tar.bz2 emacs-8ea1765fea35e68189ba5edca74d61660950ee8b.zip |
Prefer https for other domains than gnu.org in package URL
* lisp/emacs-lisp/package.el (describe-package-1): Prefer https for
some other common domains in the package URL.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/package.el | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index a0bfcbb24fa..94087d172c9 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2620,12 +2620,17 @@ Helper function for `describe-package'." (package-desc-name pkg)))) (insert "\n"))) (when homepage - ;; Prefer https for the homepage of packages on gnu.org. - (if (string-match-p "^http://\\(elpa\\|www\\)\\.gnu\\.org/" homepage) - (let ((gnu (cdr (assoc "gnu" package-archives)))) - (and gnu (string-match-p "^https" gnu) - (setq homepage - (replace-regexp-in-string "^http" "https" homepage))))) + ;; Prefer https for the homepage of packages on common domains. + (when (string-match-p (rx bol "http://" (or "elpa." "www." "git." "") + (or "nongnu.org" "gnu.org" "sr.ht" + "emacswiki.org" "gitlab.com" "github.com") + "/") + homepage) + ;; But only if the user has "https" in `package-archives'. + (let ((gnu (cdr (assoc "gnu" package-archives)))) + (and gnu (string-match-p "^https" gnu) + (setq homepage + (replace-regexp-in-string "^http" "https" homepage))))) (package--print-help-section "Homepage") (help-insert-xref-button homepage 'help-url homepage) (insert "\n")) |