From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1038 invoked from network); 8 Feb 1999 20:02:06 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 8 Feb 1999 20:02:06 -0000 Received: (qmail 6526 invoked by alias); 8 Feb 1999 20:00:24 -0000 Mailing-List: contact zsh-users-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 2122 Received: (qmail 6518 invoked from network); 8 Feb 1999 20:00:22 -0000 Date: Mon, 8 Feb 1999 14:59:28 -0500 From: Sweth Chandramouli To: zsh-users@sunsite.auc.dk Subject: Re: setopt and alias questions Message-ID: <19990208145928.C4151@astaroth.nit.gwu.edu> Mail-Followup-To: zsh-users@sunsite.auc.dk References: <19990207193735.A2060@astaroth.nit.gwu.edu> <990207175931.ZM8940@candle.brasslantern.com> <19990207235214.A2653@astaroth.nit.gwu.edu> <990207233343.ZM10079@candle.brasslantern.com> <19990208103038.A3447@astaroth.nit.gwu.edu> <990208104550.ZM14297@candle.brasslantern.com> <19990208141534.A4151@astaroth.nit.gwu.edu> <990208114403.ZM14493@candle.brasslantern.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95i In-Reply-To: <990208114403.ZM14493@candle.brasslantern.com> On Mon, Feb 08, 1999 at 11:44:03AM -0800, Bart Schaefer wrote: > On Feb 8, 2:15pm, Sweth Chandramouli wrote: > } Subject: Re: setopt and alias questions > } > } On Mon, Feb 08, 1999 at 10:45:50AM -0800, Bart Schaefer wrote: > } > > } > autoload $^fpath/*(.:t) > } i don't like error messages, however, so i use the loop to test > } for the existance of autoloadable files before doing the actual autoload: > } > } for DIRNAME in ${fpath} ; do > } if [[ -x ${DIRNAME}/*(.x:t) ]] ; then > } autoload ${DIRNAME}/*(.x:t) > } fi; > } done; > > That loop will never autoload anything -- unless there happens to be a > file in the current directory with the same name as one in ${DIRNAME}. > Do you see why? yes--because i need to start cut&pasting my functions rather than typing them in. that should be -n, not -x. > Once that's fixed, the [[ -x ... ]] is completely redundant with *(.x) -- > it always succeeds, unless *(.x) doesn't match any files. (Is that the > error you're worried about?) that's the error--the glob complains if there are no functions to autoload in fpath, and i find myself copying my .zshrc to enough new machines where i haven't had a chance to set up any functions in .zfunc and can't nfs-mount my "real" home directory that the error message can get annoying. with the -n, it just tests to see if there are, in fact, any executable files in that directory; if not, it won't try to autoload (and thus glob). > Finally, there's no requirement that files have the execute mode set in > order to be autoloadable, so using (x) may miss some. that's a requirement i picked up from someone on this list, or maybe it was in the examples--it lets me "turn off" autoloading of individual functions by removing their execute bit. i have some functions that i don't want to use anymore, for example, but which i want to keep around so i don't have to reinvent the wheel if i later on want to create a similar function; this lets me keep them all in one dir. -- sweth. -- Sweth Chandramouli IS Coordinator, The George Washington University / (202) 994 - 8521 (V) / (202) 994 - 0458 (F) *