环境:windows 10
Emacs版本:原生GNU Emacs 28.2,自行配置未使用框架。
配置elpa镜像站有一句是给package-archives
变量赋值,抄的配置是这样,工作正常。
(setq package-archives '(
("stable-melpa" . "https://mirrors.cloud.tencent.com/elpa/stable-melpa/" )
;;("melpa" . "https://mirrors.cloud.tencent.com/elpa/melpa/")
("gnu" . "https://mirrors.cloud.tencent.com/elpa/gnu/")
) )
但是想遇到网络问题方便切换源,复制一大段有点麻烦,偷懒想设置一个临时变量host,改起来方便,反正后面路径是一样。于是改成以下:
(setq-local elpa-host "https://mirrors.cloud.tencent.com/elpa") ; 腾讯镜像站
;(setq-local elpa-host "https://mirrors.tuna.tsinghua.edu.cn/elpa") ; 清华镜像站
;(setq-local elpa-host "https://mirrors.aliyun.com/elpa") ; 阿里镜像站
;(setq-local elpa-host "http://elpa.emacs-china.org") ; emacs-china镜像站
(setq package-archives '(
("stable-melpa" . (concat elpa-host "/stable-melpa/") )
("gnu" . (concat elpa-host "/gnu/") )
) )
期间还在设置package-archives
之前用message输出路径,都是正常的。重新启动emacs正常,但运行package-list
命令就报错,“failed download xxx”。
另还试过把concat换成(expand-file-name “stable-melpa” elpa-host),但message输出路径就已经不对了,带上一堆前面别的配置语句用的路径。
值都是一样的,为什么用concat或expand-file-name拼接就不行呢?