]> git.neil.brown.name Git - edlib.git/commitdiff
config: ensure new config overrides earlier config.
authorNeilBrown <neil@brown.name>
Sun, 18 Jun 2023 21:46:27 +0000 (07:46 +1000)
committerNeilBrown <neil@brown.name>
Wed, 28 Jun 2023 07:51:41 +0000 (17:51 +1000)
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 <neil@brown.name>
DOC/TODO.md
edlib.ini
lib-config.c

index ea0c1e898ba3305320e15513499a6c22b5be1bc2..493079ceeac419d269422b70ab5984c14029c9f7 100644 (file)
@@ -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?
index d3917e7c9634b4ea37ac4bc2a994331f6ae6eaec..63de08ab8f06eac3c82a859971a37dc394f7f7be 100644 (file)
--- 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
index 192c2785d0efbe14f6395fc89d291c3367d90dde..5e97519c85f9ff276f63dc45fc548d86056d0f52 100644 (file)
@@ -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;