[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Nov 17 22:49:12 1992 
Subject:Re: Yet another anoying feature of VED 
From:Aaron Sloman 
Volume-ID:921117.05 

tmr@cs.bham.ac.uk (Tim Read) writes:

> Organization: School of Computer Science, University of Birmingham, UK
> Date: Tue, 17 Nov 1992 15:01:29 GMT
>
> I would like to be able to start up ved with several files at once, doing:
>
> ved foo1.p foo2.p foo3.p
>
> (after a long pause)

presumably compiling your init.p and your vedinit.p, and then
(possibly) searching your vedsearchlist for a non-existent file
whose name includes spaces.

You can reduce the pause by always using a saved image with your
VED stuff pre-compiled. See below.

> ....just starts ved with one file called:
>  "foo1.p foo2.p foo3.p" - not what I want.

> In emacs doing this (ie emacs foo1.p foo2.p foo3.p) will correctly
                                                           ^^^^^^^^??
> load in the files I require. Can some kind soul tell me how to do
> this with ved?

This is correct relative to *your* intentions, but not everyone
would agree. The above could not be the default behaviour because
Unix allows file names with spaces, and if users wish to be able to
edit them with VED they should be allowed to (though for students I
usually redefine ved_ved so as to complain if the filename contains
potentially troublesome characters).

There are various ways to make VED do what you want. Here's one.

When you give the command "ved" to the shell, this runs
the $popsys/ved executable, which is actually just a link to
$popsys/basepop11

Because basepop11 starts up via the command "ved", under Unix it
looks to see whether there's an environment variable $pop_ved, and
in fact there is, with the following setting, defined in
$popsys/popenv

    setenv pop_ved "$pop_pop11 :sysinitcomp();ved"

and $pop_pop11 is defined thus:

    setenv pop_pop11 "-$popsavelib/startup.psv"

Thus, when you type "ved foo" that's interpreted as if you had
typed

    basepop11  $pop_pop11 :sysinitcomp();ved foo

which is equivalent to

    basepop11 -$popsavelib/startup.psv :sysinitcomp();ved foo

And that runs the basepop11 executable, with the startup.psv saved
image (providing various hooks for X) and then because it finds
the colon it treats the rest of the line as a Pop-11 command. So it
executes sysinitcomp(); (which compiles your init.p file), then
ved runs with argument foo.

You can change the way it starts up by re-defining the pop_ved
environment variable.

    e.g. setenv pop_ved "$pop_pop11 :sysinitcomp();myved"

and then in your init.p define myved to be a macro that reads in a
string of file names separated by spaces, thus

define macro myved;
    ;;; Read a string of file names, to end of line, and edit them.
	;;; Based on lib popvedcommand;

	lvars file,
        args = sysparse_string(readstringline());

	unless args == [] then
    	;;; make a list of edit commands
    	[% for file in args do edit(%file%) endfor %] -> args;

    	;;; Put all but the first, into VED's command input stream;
    	vedinput(back(args));

    	;;; run the first
    	front(args)()

    endunless;
enddefine;

After that

    ved file1 file2 file3

will start off those three files.

If you wish to use your own saved image you can use syssave (see
HLPE SYSSAVE), or mkimage (see HELP MKIMAGE) to create a re-usable
saved image with your utilities precompiled. You can then make it
start up by reading poparglist, and if there are several arguments
it can treat them as file names, as the macro myved does above.

I hope this helps. As ever there are alternative solutions.

Aaron
-- 
Aaron Sloman, School of Computer Science,
The University of Birmingham, B15 2TT, England
EMAIL   A.Sloman@cs.bham.ac.uk  OR A.Sloman@bham.ac.uk
Phone: +44-(0)21-414-3711       Fax:   +44-(0)21-414-4281