From: NeilBrown Date: Tue, 27 Jun 2023 01:45:36 +0000 (+1000) Subject: discard old auto-load code X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=c5222e4515602c76730f7a2297f514b87819c952;p=edlib.git discard old auto-load code Now that lib-config can autoload modules, get rid of the old limited approach. Signed-off-by: NeilBrown --- diff --git a/DOC/TODO.md b/DOC/TODO.md index 91c6f88b..f28b2141 100644 --- a/DOC/TODO.md +++ b/DOC/TODO.md @@ -768,7 +768,7 @@ Module features - [X] C config module that reads an ini-style file to set attributes based on path - [ ] configure "initial_panes" -- [ ] discard old auto-load?? +- [X] discard old auto-load?? - [ ] file patterns for "complete" to (optionally) ignore - [ ] read .gitignore and add to "ignore" list - [ ] top/bottom margin - "render-vmargin" set on view or doc?? diff --git a/core-editor.c b/core-editor.c index ad0d0ad4..4b9277ee 100644 --- a/core-editor.c +++ b/core-editor.c @@ -198,46 +198,6 @@ DEF_CMD(editor_load_module) return Efail; } -DEF_CMD(editor_auto_load) -{ - int ret; - struct ed_info *ei = ci->home->data; - struct map *map = ei->map; - const char *mod = ksuffix(ci, "attach-"); - char *mod2 = NULL; - - /* Check the key really doesn't exist, rather than - * it fails - */ - if (key_lookup_cmd(map, ci->key)) - return Efallthrough; - - if (strstarts(mod, "doc-") || - strstarts(mod, "render-") || - strstarts(mod, "mode-") || - strstarts(mod, "display-")) - ; - else { - const char *m = strrchr(ci->key, '-'); - if (m) { - m += 1; - mod2 = malloc(4+strlen(m)+1); - strcpy(mod2, "lib-"); - strcpy(mod2+4, m); - mod = mod2; - } - } - - ret = call("global-load-module", ci->home, 0, NULL, - mod, 0); - free(mod2); - - if (ret > 0) - /* auto-load succeeded */ - return key_lookup(map, ci); - return Efallthrough; -} - DEF_CMD(editor_auto_event) { /* Event handlers register under a private name so we @@ -512,7 +472,6 @@ struct pane *editor_new(void) key_add(ed_map, "global-get-command", &global_get_command); key_add(ed_map, "global-load-module", &editor_load_module); key_add(ed_map, "global-config-dir", &global_config_dir); - key_add_prefix(ed_map, "attach-", &editor_auto_load); key_add_prefix(ed_map, "event:", &editor_auto_event); key_add_prefix(ed_map, "global-multicall-", &editor_multicall); key_add_prefix(ed_map, "editor:request:", diff --git a/edlib.ini b/edlib.ini index bb160de9..6fb466e8 100644 --- a/edlib.ini +++ b/edlib.ini @@ -125,6 +125,32 @@ lib-charset = PREFIX charset-to-utf8-windows- PREFIX charset-to-utf8-iso-8859- + +doc-docs = attach-doc-docs +doc-list = attach-doc-list +doc-multipart = attach-doc-multipart +render-complete = attach-render-complete +mode-emacs = attach-mode-emacs +display-ncurses = attach-display-ncurses +lib-abbrev = attach-abbrev +lib-base64 = attach-base64 +lib-crop = attach-crop +lib-history = attach-history +lib-input = attach-input +lib-keymap = attach-keymap +lib-libevent = attach-libevent +lib-linefilter = attach-linefilter +lib-markup = attach-markup +lib-menu = attach-menu +lib-messageline = attach-messageline +lib-renderline = attach-renderline +lib-rfc822header = attach-rfc822header +lib-tile = attach-tile +lib-view = attach-view +lib-keymap = attach-global-keymap +lib-glibevents = attach-glibevents +lib-shellcmd = attach-shellcmd + [file:COMMIT_EDITMSG*] APPEND view-default = ,textfill,whitespace,autospell fill-width = 72