[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: es decompression hack



    put this in your .esrc (provided you're using 0.8 or later, though
    one could construct an 0.79 version with test instead of access)
    and you'll be able to use < with files that don't exist, provided
    that a compressed .Z version of the files does exist.

Paul,

That, Sir, is truly slick.  A very neat hack indeed.  Top notch stuff!

Now how about _this_.  Think back if you will to my earlier handwave
on extending syntax for es.  We're going for the moby handwave now.

You all have probably seen at least one program that has this idea
built into it (i.e. if the input file as named doesn't exist, see if
tacking on .Z gives one that does and zcat on the fly if so); one
that springs to mind right away is the X11 image viewer "xv".

This shouldn't be built into programs.  _It should be done by the
shell, as a generalisation of Paul's hack:_

#
# The syntaxer knows what an "argument" is.  Introduce a new
# hygienic syntactic notion: a "fileargument" is an "argument"
# that doesn't begin with + or -.
#

syntax-variable fileargument ::= argument with (not (~ $1 '^(\+|-)'));

#
# Define a function that'll allow us to declare that certain commands
# take filearguments (as opposed to, say, commands whose arguments
# are hostnames/IP addresses, like telnet -- boy are we having fun
# now, anyone for DNS-based spelling correction?)
#

syntax-function fc ::=
	{
		for (command in $*)
			let-syntax in $command {
				argument ::= fileargument
			}
	}

#
# Now we can load up our .esrc with loads of lines like this:
#

syntax {

fc cat ls more strip size
...

}

Then, of course, all we have to do is hook Paul's hack into the
notion of a "fileargument" and voila!!!

(I'm going to get you guys to deliver extensible syntax yet....  grin!)

Cute or what?

OK,
John.