zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@ifh.de>
To: Bernd Eggink <eggink@rrz.uni-hamburg.de>,
	zsh-workers@math.gatech.edu (Zsh hackers list)
Subject: Re: autoload
Date: Wed, 03 Sep 1997 09:29:46 +0200	[thread overview]
Message-ID: <199709030729.JAA03667@sgi.ifh.de> (raw)
In-Reply-To: "Bernd Eggink"'s message of "Tue, 02 Sep 1997 16:24:59 MET." <340C21BB.C9C3CCE@rrz.uni-hamburg.de>

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 <pws@ifh.de>       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.


      parent reply	other threads:[~1997-09-03  7:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-09-02 14:24 autoload Bernd Eggink
1997-09-02 15:43 ` autoload Andrew Main
1997-09-03  7:29 ` Peter Stephenson [this message]

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=199709030729.JAA03667@sgi.ifh.de \
    --to=pws@ifh.de \
    --cc=eggink@rrz.uni-hamburg.de \
    --cc=zsh-workers@math.gatech.edu \
    /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).