> ...Commands that are usually located in the startup file > (global-set-key, set-default-mode etc...) are unaffected since they are not > reliant on the buffers being created or not. However, wider testing would be > appreciated.
So its good to test. Here is an updated diff, which DOES update any set-default-modes. -lum Index: main.c =================================================================== RCS file: /cvs/src/usr.bin/mg/main.c,v retrieving revision 1.64 diff -u -p -r1.64 main.c --- main.c 12 Apr 2012 04:47:59 -0000 1.64 +++ main.c 24 May 2012 15:15:34 -0000 @@ -98,19 +98,28 @@ main(int argc, char **argv) */ update(); - /* user startup file */ - if ((cp = startupfile(NULL)) != NULL) - (void)load(cp); - /* * Create scratch buffer now, killing old *init* buffer. - * This causes *scratch* to be created and made curbp, - * ensuring default modes are inherited from the startup - * file correctly + * 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); + + /* + * Now ensure any default buffer modes from the startup file are + * given to any files opened when parsing the startup file. + * Note *scratch* will also be updated. + */ + for (bp = bheadp; bp != NULL; bp = bp->b_bufp) { + bp->b_flag = defb_flag; + for (i = 0; i <= defb_nmodes; i++) { + bp->b_modes[i] = defb_modes[i]; + } + } /* Force FFOTHARG=1 so that this mode is enabled, not simply toggled */ if (init_fcn)