Index: cmd.c
===================================================================
--- cmd.c	(revision c4ba74dbb881fe02a8e19d2936144c033c7bb68f)
+++ cmd.c	(revision eb6cedc53fa5693c139f80d3e447e2ff2255ee65)
@@ -27,10 +27,10 @@
 int owl_cmddict_add_from_list(owl_cmddict *cd, owl_cmd *cmds) {
   owl_cmd *cur, *cmd;
-  for (cur = cmds; cur->name != NULL; cur++) {  
-    cmd = owl_malloc(sizeof(owl_cmd));
-    owl_cmd_create_from_template(cmd, cur);
-    owl_dict_insert_element(cd, cmd->name, (void*)cmd, NULL);
-  }
-  return 0;
+  int ret = 0;
+  for (cur = cmds; cur->name != NULL; cur++) {
+    ret = owl_cmddict_add_cmd(cd, cur);
+    if (ret < 0) break;
+  }
+  return ret;
 }
 
@@ -63,5 +63,5 @@
     return -1;
   }
-  owl_function_debugmsg("Add cmd %s", cmd->name);
+  owl_perlconfig_new_command(cmd->name);
   return owl_dict_insert_element(cd, newcmd->name, (void*)newcmd, (void(*)(void*))owl_cmd_free);
 }
Index: global.c
===================================================================
--- global.c	(revision a556caa6cc599f80f613bcf8239a5c6550f1049c)
+++ global.c	(revision eb6cedc53fa5693c139f80d3e447e2ff2255ee65)
@@ -40,5 +40,4 @@
 
   owl_variable_dict_setup(&(g->vars));
-  owl_cmddict_setup(&(g->cmds));
 
   g->lines=LINES;
@@ -121,4 +120,10 @@
 }
 
+/* Called once perl has been initialized */
+void owl_global_complete_setup(owl_global *g)
+{
+  owl_cmddict_setup(&(g->cmds));
+}
+
 void _owl_global_setup_windows(owl_global *g) {
   int cols, typwin_lines;
Index: owl.c
===================================================================
--- owl.c	(revision 301c975a7a71ae32c393a1f07001ae97eb19afca)
+++ owl.c	(revision eb6cedc53fa5693c139f80d3e447e2ff2255ee65)
@@ -235,4 +235,6 @@
     exit(1);
   }
+
+  owl_global_complete_setup(&g);
 
   /* setup the default filters */
Index: perl/lib/BarnOwl.pm
===================================================================
--- perl/lib/BarnOwl.pm	(revision 22b54a7e11a865e233b7487d805219989c6e31aa)
+++ perl/lib/BarnOwl.pm	(revision eb6cedc53fa5693c139f80d3e447e2ff2255ee65)
@@ -167,33 +167,4 @@
     $m->legacy_populate_global();
     return &BarnOwl::Hooks::_receive_msg($m);
-}
-
-=head2 AUTOLOAD
-
-BarnOwl.pm has a C<AUTOLOAD> method that translates unused names in
-the BarnOwl:: namespace to a call to BarnOwl::command() with that
-command. Underscores are also translated to C<->s, so you can do
-e.g. C<BarnOwl::start_command()> and it will be translated into
-C<start-command>.
-
-So, if you're looking for functionality that you can't find in the
-perl interface, check C<:show commands> or C<commands.c> in the
-BarnOwl source tree -- there's a good chance it exists as a BarnOwl
-command.
-
-=head3 BUGS
-
-There are horrible quoting issues here. The AUTOLOAD simple joins your
-commands with spaces and passes them unmodified to C<::command>
-
-=cut
-
-# make BarnOwl::<command>("foo") be aliases to BarnOwl::command("<command> foo");
-sub AUTOLOAD {
-    our $AUTOLOAD;
-    my $called = $AUTOLOAD;
-    $called =~ s/.*:://;
-    $called =~ s/_/-/g;
-    return &BarnOwl::command("$called ".join(" ",@_));
 }
 
Index: perl/lib/BarnOwl/Hooks.pm
===================================================================
--- perl/lib/BarnOwl/Hooks.pm	(revision ee183beb7b1f02ed315026b95d9d72e0913908bd)
+++ perl/lib/BarnOwl/Hooks.pm	(revision eb6cedc53fa5693c139f80d3e447e2ff2255ee65)
@@ -3,4 +3,6 @@
 
 package BarnOwl::Hooks;
+
+use Carp;
 
 =head1 BarnOwl::Hooks
@@ -180,4 +182,30 @@
 }
 
+sub _new_command {
+    my $command = shift;
+    (my $symbol = $command) =~ s/-/_/g;
+    my $package = "BarnOwl";
+
+    if($symbol =~ m{^edit:(.+)$}) {
+        $symbol = $1;
+        $package = "BarnOwl::Editwin";
+    } else {
+        $symbol =~ s/:/_/;
+    }
+    {
+        no strict 'refs';
+        if(defined(*{"${package}::${symbol}"}{CODE})) {
+            return;
+        }
+        *{"${package}::${symbol}"} = sub {
+            if(@_ == 1 && $_[0] =~ m{\s}) {
+                carp "DEPRECATED: ${package}::${symbol}: Tokenizing argument on ' '.\n"
+                . "In future versions, the argument list will be passed to\n"
+                . "'$command' directly. Tokenize yourself, or use BarnOwl::command()\n"
+            }
+            BarnOwl::command($command . " " . join(" ", @_))
+          };
+    }
+}
 
 1;
Index: perlconfig.c
===================================================================
--- perlconfig.c	(revision a556caa6cc599f80f613bcf8239a5c6550f1049c)
+++ perlconfig.c	(revision eb6cedc53fa5693c139f80d3e447e2ff2255ee65)
@@ -429,4 +429,29 @@
 }
 
+void owl_perlconfig_new_command(char *name)
+{
+  int i, count;
+  SV *rv;
+  dSP;
+
+  ENTER;
+  SAVETMPS;
+
+  PUSHMARK(SP);
+  XPUSHs(sv_2mortal(newSVpv(name, 0)));
+  PUTBACK;
+
+  call_pv("BarnOwl::Hooks::_new_command", G_SCALAR|G_VOID);
+
+  SPAGAIN;
+
+  if(SvTRUE(ERRSV)) {
+    owl_function_error("%s", SvPV_nolen(ERRSV));
+  }
+
+  FREETMPS;
+  LEAVE;
+}
+
 char *owl_perlconfig_perlcmd(owl_cmd *cmd, int argc, char **argv)
 {
