From: NeilBrown Date: Sun, 18 Jun 2023 21:46:27 +0000 (+1000) Subject: config: ensure new config overrides earlier config. X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=d1eb3126fb65941ebd7ac89bb122b103b1ed8be3;p=edlib.git config: ensure new config overrides earlier config. Config must be applied in the order is read. So when recording filename triggers, always add to the end of the list. And when including per-user configuration, read it after the global configuration. Signed-off-by: NeilBrown --- diff --git a/DOC/TODO.md b/DOC/TODO.md index ea0c1e89..493079ce 100644 --- a/DOC/TODO.md +++ b/DOC/TODO.md @@ -1023,6 +1023,11 @@ At the very least I want a calendar pop-up. Info is widely used... rendering it like markdown and allowing browsing would be nice. +### man page viewer + +- [ ] MANWIDTH=72 MAN_KEEP_FORMATTING=yes man page and process X\bX + and _\bX for bold and underline. + ### A suite of tools making use of some sort of "mark-down" like language Restructured text? Markdown? Commonmark? Markright? diff --git a/edlib.ini b/edlib.ini index d3917e7c..63de08ab 100644 --- a/edlib.ini +++ b/edlib.ini @@ -1,6 +1,4 @@ -include = config.ini - [module] lang-python = global-load-modules:python @@ -141,3 +139,7 @@ fill:start-re = "^(" " *- *\\[[ X]]|" # todo list item " *#+|" # section head " *[0-9]*\\.)" # Numbered list + +[include] + +include = config.ini diff --git a/lib-config.c b/lib-config.c index 192c2785..5e97519c 100644 --- a/lib-config.c +++ b/lib-config.c @@ -9,7 +9,8 @@ * file:pattern - set attributes when matching file visited * (not implemented fully yet) * - * When not in a section, include= will load another file. + * When not in a section, or in the "include" section, include= will + * load another file. * * Syntax for ini file * - individual lines must not exceed 256 chars. Longer lines are @@ -182,13 +183,13 @@ struct config_data { char *path safe; struct attrset *attrs; struct trigger *next; - } *triggers; + } *triggers, *last_trigger; }; static void add_trigger(struct config_data *cd safe, char *path safe, char *name safe, char *val safe, int append) { - struct trigger *t = cd->triggers; + struct trigger *t = cd->last_trigger; if (strstarts(name, "TESTING ")) { if (getenv("EDLIB_TESTING") == NULL) @@ -202,9 +203,13 @@ static void add_trigger(struct config_data *cd safe, char *path safe, } if (!t || strcmp(t->path, path) != 0) { alloc(t, pane); - t->next = cd->triggers; - cd->triggers = t; t->path = strdup(path); + t->next = NULL; + if (cd->last_trigger) + cd->last_trigger->next = t; + else + cd->triggers = t; + cd->last_trigger = t; } if (append) { const char *old = attr_find(t->attrs, name); @@ -277,7 +282,7 @@ static void handle(void *data, char *section safe, char *name safe, char *value return; cd = data; - if (strcmp(section, "") == 0) { + if (strcmp(section, "") == 0 || strcmp(section,"include") == 0) { if (strcmp(name, "include") == 0) { load_config(value, data, path); return;