Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: 4.2.0 released



Bart Schaefer wrote:
> Assorted thoughts ...
> 
> On Mar 19, 11:36am, Peter Stephenson wrote:
> }
> } - Suffix aliases allow the shell to run a command on a file by suffix,
> }   e.g `alias -s ps=gv' makes `foo.ps' execute `gv foo.ps'.  Supplied
> }   function zsh-mime-setup uses existing mailcap and mime.types files
> }   to set up suitable aliases.
> 
> Reading that, I wonder ... why did we do this with suffixes?

Easy to implement, simple to use, does the basics of what you actually
need, quick at run time (no pattern matching), nobody offered to write
anything else ...

It's still possible to add a generic pattern matcher, if anybody wants
to.  Since I can't actually imagine using it myself (unlike suffix
aliases), I selfishly don't feel like doing it.

> Why not be
> Unix-like rather than DOS-like:  check /etc/magic on any file that the OS
> fails to execute, and choose the command based on that?

Well, that's even more difficult, but yes, it's perfectly reasonable to
add a hook on failure to execute.  It could do other things, like check
#! lines and see if the path to the executable is wrong and the
executable can be found in the path.

Warning to anybody doing this:  error numbers on failed execution can be
a bit tricky.  You need to handle ENOENT as well as ENOEXEC (and
possibly others).

I'm not actually sure what state the shell is in execute(), i.e. whether
it could run such a handler as a function or would need to exec it
externally.  The latter, at least, is pretty simple to add.

> } Line editor:
> } - recursive editing
>
> Which is not quite the same as recursively invoking zle, e.g., I think you
> still get some sort of warning if you try to run "vared" from inside a
> widget function.

Yes, it's recursive within the widget system, not at the level of the
main execution loop.  You have to use a special widget; the editor
itself is not reentrant.

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************



Messages sorted by: Reverse Date, Date, Thread, Author