From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1595 invoked by alias); 21 Dec 2012 18:11:40 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17490 Received: (qmail 4300 invoked from network); 21 Dec 2012 18:11:38 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <121221101125.ZM31867@torch.brasslantern.com> Date: Fri, 21 Dec 2012 10:11:25 -0800 In-reply-to: <20121220090305.GD1915@helium> Comments: In reply to Brandon Sandrowicz "Re: Function not found" (Dec 20, 4:03am) References: <50D1DBBC.20200@eastlink.ca> <20121219235850.GB15388@lorien.comfychair.org> <50D1E541.5030209@eastlink.ca> <37060.148.87.67.207.1355985863.squirrel@webmail.sonic.net> <20121220090305.GD1915@helium> In-reply-to: Comments: In reply to Jeremie Roquet "Re: Function not found" (Dec 20, 12:02pm) X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: Function not found MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Dec 20, 4:03am, Brandon Sandrowicz wrote: } } On Wed, Dec 19, 2012 at 10:44:23PM -0800, czech@sonic.net wrote: } > } > _ssh() { } > ssh -XC "czechar@$@" } > } } > } > autoload -- ~/.zfunc/[^_]*(:t) } > fpath=( ~/.zfunc $fpath ) } } The autoload command you have here appears to be your problem. } } If your _ssh function is defined in the file ~/.zfunc/_ssh, your } original command *could* work, but you would have to remove the '[^_]' } which prevents files beginning with underscores. My guess is that the [^_] was copied from a recipe related to the completion system. In most cases (as Jeremie later mentioned) any file with a leading underscore in its name would contain a completion function of some kind, and would therefore have a "#compdef" line at the top. These files are autoloaded by the compinit command (if the $fpath is properly set when compinit is run) and therefore don't need to be autoloaded a second time from .zshrc. } To be clear, autoload wants the names of the *functions*, not the names } of the files. Your approach above could work so long as each function is } in a separate file, and both (file and function) share the same exact } name (i.e. can't be _ssh.zsh). To be even more specific, autoload depends upon the names of the files being the *same* as the names of the functions. Generally, the file should contain only the function body, not the func() { ... } syntax. If that syntax is used in the file, you need "autoload -k". There are exceptions, and reasons for a file to contain more than one function, but you should avoid that until you understand the operation in detail. -- Barton E. Schaefer