Add basic support for Emacs

This commit is contained in:
Aoran Zeng 2023-09-10 17:18:05 +08:00
parent 52562dfbe6
commit 89abf5a1c4
2 changed files with 38 additions and 4 deletions

25
chsrc.c
View File

@ -1512,6 +1512,27 @@ wr_tex_setsrc(char* option)
}
void
wr_emacs_setsrc(char* option)
{
int index = 0;
if (NULL!=option) {
index = lets_find_mirror(wr_emacs, option);
} else {
index = lets_test_speed(wr_emacs);
}
source_info source = wr_emacs_sources[index];
chsrc_say_selection (&source);
xy_warn("chsrc: 抱歉Emacs换源涉及Elisp您可手动查阅并换源:");
puts(source.url);
chsrc_say_thanks (&source);
}
/************************************** Begin Target Matrix ****************************************/
def_target_info(pl_ruby);
def_target_info(pl_python);
@ -1594,12 +1615,12 @@ def_target_info(wr_tex);
target_info
wr_anaconda_target = {NULL, NULL, NULL, 0},
wr_emacs_target = {NULL, NULL, NULL, 0},
wr_emacs_target = {wr_emacs_setsrc, NULL, wr_emacs_sources, wr_emacs_sources_n},
wr_brew_target = {NULL, NULL, NULL, 0};
static const char
*wr_anaconda[] = {"conda", "anaconda", NULL, targetinfo(&wr_anaconda_target)},
*wr_emacs [] = {"emacs", NULL, targetinfo(&wr_emacs_target)},
*wr_emacs [] = {"emacs", "elpa", NULL, targetinfo(&wr_emacs_target)},
*wr_tex [] = {"latex", "ctan", "tex", "texlive", "miktex", "tlmgr", "mpm", NULL, targetinfo(&wr_tex_target)},
*wr_brew [] = {"brew", "homebrew", NULL, targetinfo(&wr_brew_target)},
**wr_softwares[] =

17
chsrc.h
View File

@ -500,9 +500,22 @@ wr_tex_sources[] = {
{&Lzuoss, "https://mirror.lzu.edu.cn/CTAN/systems/texlive/tlnet"},
{&Jlu, "https://mirrors.jlu.edu.cn/CTAN/systems/texlive/tlnet"},
{&Sustech, "https://mirrors.sustech.edu.cn/CTAN/systems/texlive/tlnet"}
};
},
/**
* 2023-09-10
*
* @note Emacs用户往往只需要一次性换源 chsrc
*/
wr_emacs_sources[] = {
{&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/docs/emacs-elpa"},
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/help/elpa/"},
{&Bfsu, "https://mirrors.bfsu.edu.cn/help/elpa/"},
{&Ustc, "https://mirrors.ustc.edu.cn/help/elpa.html"},
{&Zju, "https://mirrors.zju.edu.cn/docs/elpa/"}
};
/* 辅助函数 */
@ -565,7 +578,7 @@ def_target_sources_n(os_kali); def_target_sources_n(os_openbsd); def_
def_target_sources_n(os_arch); def_target_sources_n(os_gentoo); def_target_sources_n(os_netbsd);
def_target_sources_n(os_deepin); def_target_sources_n(os_openeuler); def_target_sources_n(os_openkylin);
def_target_sources_n(wr_tex);
def_target_sources_n(wr_tex); def_target_sources_n(wr_emacs);
/* Target Info */
typedef struct {