From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21388 invoked from network); 3 Sep 1997 07:49:41 -0000 Received: from math.gatech.edu (list@130.207.146.50) by coral.primenet.com.au with SMTP; 3 Sep 1997 07:49:41 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id DAA02286; Wed, 3 Sep 1997 03:29:47 -0400 (EDT) Resent-Date: Wed, 3 Sep 1997 03:29:47 -0400 (EDT) Message-Id: <199709030729.JAA03667@sgi.ifh.de> To: Bernd Eggink , zsh-workers@math.gatech.edu (Zsh hackers list) Subject: Re: autoload In-reply-to: "Bernd Eggink"'s message of "Tue, 02 Sep 1997 16:24:59 MET." <340C21BB.C9C3CCE@rrz.uni-hamburg.de> Date: Wed, 03 Sep 1997 09:29:46 +0200 From: Peter Stephenson Resent-Message-ID: <"MQxIQ3.0.fZ.h7H3q"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/3477 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Bernd Eggink wrote: > If a file contains more than one autoload function, strange things > happen (3.1.2 and older versions): > > # File 'f1' > function f1() { print $0 $*; } > function f2() { print $0 $*; } > > At the prompt, type > > autoload f1 f2 > fpath=(.) > f1 # NOTHING HAPPENS! > functions # shows that f1 und f2 are defined > f1 # now f1 is called! > > Only if the definition of f2 is deleted from the file, the first call of > f1 works. I think this has been tinkered about with at some stage, so it doesn't quite behave the way the FAQ now claims: I have to repost the FAQ (a bit late) so I'll alter it. The short answer is that in recent versions of the shell you need to set the option kshautoload. Otherwise, the file is treated as containing a definition of the function (rather than the body of the function) if and only if the file's executable contents are just that definition and nothing else. This is to try and guess the user's intentions. With kshautoload set it does what you're expecting, no guessing. -- Peter Stephenson Tel: +49 33762 77366 WWW: http://www.ifh.de/~pws/ Fax: +49 33762 77413 Deutsches Elektronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen DESY-IfH, Platanenallee 6, 15738 Zeuthen, Germany.