From: NeilBrown Date: Sun, 18 Jun 2023 22:39:10 +0000 (+1000) Subject: config: support PREFIX commands for module auto-load X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=eb40218b9191e8abe812d1ca4d8625cf5dbb258b;p=edlib.git config: support PREFIX commands for module auto-load Now that prefix commands are handled, we can do charet properly and discard the "ALWAYS" hack. Signed-off-by: NeilBrown --- diff --git a/edlib.ini b/edlib.ini index 744a2f0e..bb160de9 100644 --- a/edlib.ini +++ b/edlib.ini @@ -118,7 +118,12 @@ lib-ical-to-text = ical-to-text lib-utf8 = attach-charset-utf-8 attach-utf8 -lib-charset = ALWAYS +lib-charset = + PREFIX attach-charset-windows- + PREFIX attach-charset-iso-8859- + attach-charset-us-ascii + PREFIX charset-to-utf8-windows- + PREFIX charset-to-utf8-iso-8859- [file:COMMIT_EDITMSG*] APPEND view-default = ,textfill,whitespace,autospell diff --git a/lib-config.c b/lib-config.c index 4c6bcd08..e5093873 100644 --- a/lib-config.c +++ b/lib-config.c @@ -298,17 +298,18 @@ static void handle(void *data, char *section safe, char *name safe, char *value if (strcmp(section, "module") == 0 && value[0]) { struct mod_cmd *mc; - if (strcmp(value, "ALWAYS") == 0) { - call("global-load-module", cd->root, 0, NULL, name); - return; - } + mc = malloc(sizeof(*mc)); mc->module = strdup(name); mc->tried = 0; mc->c = autoload; mc->c.free = al_free; - call_comm("global-set-command", cd->root, &mc->c, 0, NULL, - value); + if (strstarts(value, "PREFIX ")) + call_comm("global-set-command-prefix", cd->root, &mc->c, 0, NULL, + value + 7); + else + call_comm("global-set-command", cd->root, &mc->c, 0, NULL, + value); return; }