"any of the *file* commands"

should be...

any of the other *file* commands

such as insert-file, etc..



----- Forwarded message from Mark Lumsden <m...@showcomplex.com> -----

From: Mark Lumsden <m...@showcomplex.com>
To: tech@openbsd.org
Subject: mg(1) start up file diffs (2 of 2)

Further to my previous email, I noticed if I tried to use any of the *file*
commands in the startup ~/.mg file, nothing happened. By looking at main.c,
I realised that the order of starup function calls was the problem. This diff
moves the creation of the startup buffers before parsing the startup file.

Now an ~/.mg file such as:

find-file main.c
insert-file lines.c

Will work as expected. 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.

Comments/ok?

-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      20 May 2012 17:11:24 -0000
@@ -98,19 +98,18 @@ 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
         */
-
        if ((bp = bfind("*init*", FALSE)) != NULL)
                killbuffer(bp);
+
+       /* user startup file */
+       if ((cp = startupfile(NULL)) != NULL)
+               (void)load(cp);
 
        /* Force FFOTHARG=1 so that this mode is enabled, not simply toggled */
        if (init_fcn)

----- End forwarded message -----

Reply via email to