After a recent commit (http://marc.info/?l=openbsd-tech&m=133787310204563&w=2) I realised the *init* buffer could be removed since we went back and updated modes after scratch was created.
There is a side effect to this diff; theo mode now works from the command line: $ mg -f theo [it had been broken for a while] Comments/ok -lum Index: main.c =================================================================== RCS file: /cvs/src/usr.bin/mg/main.c,v retrieving revision 1.65 diff -u -p -r1.65 main.c --- main.c 25 May 2012 05:05:48 -0000 1.65 +++ main.c 28 May 2012 14:09:51 -0000 @@ -23,7 +23,7 @@ struct mgwin *curwp; /* current windo struct mgwin *wheadp; /* MGWIN listhead */ char pat[NPAT]; /* pattern */ -static void edinit(PF); +static void edinit(struct buffer *); static __dead void usage(void); extern char *__progname; @@ -40,11 +40,11 @@ usage() int main(int argc, char **argv) { - char *cp, *init_fcn_name = NULL; - PF init_fcn = NULL; - int o, i, nfiles; - int nobackups = 0; - struct buffer *bp; + char *cp, *init_fcn_name = NULL; + PF init_fcn = NULL; + int o, i, nfiles; + int nobackups = 0; + struct buffer *bp = NULL; while ((o = getopt(argc, argv, "nf:")) != -1) switch (o) { @@ -88,7 +88,7 @@ main(int argc, char **argv) vtinit(); /* Virtual terminal. */ dirinit(); /* Get current directory. */ - edinit(init_fcn); /* Buffers, windows. */ + edinit(bp); /* Buffers, windows. */ ttykeymapinit(); /* Symbols, bindings. */ /* @@ -98,13 +98,6 @@ main(int argc, char **argv) */ update(); - /* - * Create scratch buffer now, killing old *init* buffer. - * This causes *scratch* to be created and made curbp. - */ - if ((bp = bfind("*init*", FALSE)) != NULL) - killbuffer(bp); - /* user startup file. */ if ((cp = startupfile(NULL)) != NULL) (void)load(cp); @@ -194,26 +187,23 @@ notnum: } /* - * Initialize default buffer and window. - * Initially, buffer is named *init*. This is changed later - * to *scratch* after the startup files are read. + * Initialize default buffer and window. Default buffer is called *scratch*. */ static void -edinit(PF init_fcn) +edinit(struct buffer *bp) { - struct buffer *bp; struct mgwin *wp; bheadp = NULL; - bp = bfind("*init*", TRUE); /* Text buffer. */ + bp = bfind("*scratch*", TRUE); /* Text buffer. */ if (bp == NULL) panic("edinit"); wp = new_window(bp); if (wp == NULL) - panic("Out of memory"); + panic("edinit: Out of memory"); - curbp = bp; /* Current ones. */ + curbp = bp; /* Current buffer. */ wheadp = wp; curwp = wp; wp->w_wndp = NULL; /* Initialize window. */