(defcustomdotfile-package-archives-alist(let*((no-ssl(and(memqsystem-type'(windows-ntms-dos))(not(gnutls-available-p))))(proto(ifno-ssl"http""https")))`(,(cons'melpa`(,(cons"gnu"(concatproto"://elpa.gnu.org/packages/")),(cons"melpa"(concatproto"://melpa.org/packages/")))),(cons'emacs-china`(,(cons"gnu"(concatproto"://elpa.emacs-china.org/gnu/")),(cons"melpa"(concatproto"://elpa.emacs-china.org/melpa/")))),(cons'netease`(,(cons"gnu"(concatproto"://mirrors.163.com/elpa/gnu/")),(cons"melpa"(concatproto"://mirrors.163.com/elpa/melpa/")))),(cons'ustc`(,(cons"gnu"(concatproto"://mirrors.ustc.edu.cn/elpa/gnu/")),(cons"melpa"(concatproto"://mirrors.ustc.edu.cn/elpa/melpa/")))),(cons'tencent`(,(cons"gnu"(concatproto"://mirrors.cloud.tencent.com/elpa/gnu/")),(cons"melpa"(concatproto"://mirrors.cloud.tencent.com/elpa/melpa/")))),(cons'tuna`(,(cons"gnu"(concatproto"://mirrors.tuna.tsinghua.edu.cn/elpa/gnu/")),(cons"melpa"(concatproto"://mirrors.tuna.tsinghua.edu.cn/elpa/melpa/"))))))"The package archives group list.":group'dotfile:type'(alist:key-type(symbol:tag"Archive group name"):value-type(alist:key-type(string:tag"Archive name"):value-type(string:tag"URL or directory name"))))(defcustomdotfile-package-archives'melpa"Set package archives from which to fetch.":group'dotfile:set(lambda(symbolvalue)(setsymbolvalue)()(setqpackage-archives(or(alist-getvaluedotfile-package-archives-alist)(error"Unknown package archives: `%s'"value)))):type`(choice,@(mapcar(lambda(item)(let((name(caritem)))(list'const:tag(capitalize(symbol-namename))name)))dotfile-package-archives-alist)))(defunset-package-archives(archives&optionalrefreshasync)"Set the package archives (ELPA).
REFRESH is non-nil, will refresh archive contents.
ASYNC specifies whether to perform the downloads in the background.
Save to `custom-file' if NO-SAVE is nil."(interactive(list(intern(completing-read"Select package archives: "(mapcar#'cardotfile-package-archives-alist)))));; Set option(customize-set-variable'dotfile-package-archivesarchives);; Refresh if need(andrefresh(package-refresh-contentsasync))(message"Set package archives to `%s'"archives))(set-package-archives'ustctt)
;; Initialize packages(unless(bound-and-true-ppackage--initialized); To avoid warnings in 27(setqpackage-enable-at-startupnil); To prevent initializing twice(package-initialize));; Setup `use-package'(unless(package-installed-p'use-package)(package-refresh-contents)(package-install'use-package))(eval-and-compile(setquse-package-always-ensuret)(setquse-package-always-defert)(setquse-package-expand-minimallyt)(setquse-package-enable-imenu-supportt));; Update GPG keyring for GNU ELPA(use-packagegnu-elpa-keyring-update)
;; A modern Packages Menu(use-packageparadox:init(setqparadox-execute-asynchronouslytparadox-github-tokentparadox-display-star-countnil);; Replace default `list-packages'(defunmy-paradox-enable(&rest_)"Enable paradox, overriding the default package-menu."(paradox-enable))(advice-add#'list-packages:before#'my-paradox-enable))