]> git.neil.brown.name Git - edlib.git/commitdiff
discard old auto-load code
authorNeilBrown <neil@brown.name>
Tue, 27 Jun 2023 01:45:36 +0000 (11:45 +1000)
committerNeilBrown <neil@brown.name>
Wed, 28 Jun 2023 07:51:41 +0000 (17:51 +1000)
Now that lib-config can autoload modules, get rid of the old limited
approach.

Signed-off-by: NeilBrown <neil@brown.name>
DOC/TODO.md
core-editor.c
edlib.ini

index 91c6f88b10cdecb17b9fffce83443ca069148116..f28b2141d560805951291cac625d6153ced0576f 100644 (file)
@@ -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??
index ad0d0ad40f16f3600a3ed443804715a0820e6019..4b9277ee4b8c325bc9138895ae199988a2a6c0ae 100644 (file)
@@ -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:",
index bb160de935b775ad7784c740f65979159e056171..6fb466e8074cebfa47863a02536e8afaed1755ba 100644 (file)
--- 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