zsh-users
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: zsh-users@sunsite.dk (Zsh users list)
Subject: Re: 4.2.0 released
Date: Fri, 19 Mar 2004 16:39:35 +0000	[thread overview]
Message-ID: <200403191639.i2JGdZjw025436@news01.csr.com> (raw)
In-Reply-To: "Bart Schaefer"'s message of "Fri, 19 Mar 2004 15:41:11 GMT." <1040319154111.ZM11525@candle.brasslantern.com>


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@csr.com>                  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
**********************************************************************


  reply	other threads:[~2004-03-19 16:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-19 11:36 Peter Stephenson
2004-03-19 15:41 ` Bart Schaefer
2004-03-19 16:39   ` Peter Stephenson [this message]
2004-03-19 16:45   ` Lloyd Zusman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200403191639.i2JGdZjw025436@news01.csr.com \
    --to=pws@csr.com \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).