From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18131 invoked by alias); 13 Aug 2018 13:57:10 -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: List-Unsubscribe: X-Seq: 23572 Received: (qmail 23729 invoked by uid 1010); 13 Aug 2018 13:57:10 -0000 X-Qmail-Scanner-Diagnostics: from mail-ua1-f42.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.222.42):SA:0(-1.9/5.0):. Processed in 0.749006 secs); 13 Aug 2018 13:57:10 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: pierpaolog@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6AuI4g0E/qLEa8AN+idTTUxx7/Nkj1YBLKkLsmgNpl0=; b=uNJjtETBOsdBwbGzxmY3YehAGBrTwcAWswQIM0NvuKyraaLawInh4/v/zXEJD2mUTl zWPYfeqZcyv5FJd/Cq2kDWSU2riA/X4fHMJho0Ao5MBjJIOUwJ3qu34cB3G8jpVEC3nT fkX/lHxSdwS+AWcJZiutyJrzcu6R71hUv+zKMSFyuCY4uZzsjmD712/b6Ci/vaAAPG1U aSlCj0TSzd4DAuTZavOxoLOaStGdZTbTr/rAMYkWnJLJwy+YEwHIa7zU8xWhsdU4/zwf JtaRRHMu7z2YHh/YxSAO5QC/JhPE7UXVKIT7DX1fOoDIM3TIUD73MPK5eqBdz0w5/DZv yF+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6AuI4g0E/qLEa8AN+idTTUxx7/Nkj1YBLKkLsmgNpl0=; b=Hly6+mr7MVavi6z1+6pP1BRYRpmw9HeLoI2eWcxgyyfU4njGNsattG6kySItCEqdXs sZCYIkeO4dxHzkDrWRa/XrqQzuDiNBPl1l5mTI4ecGJG77kmpHlc6PcxEmP3Ti/qPbTJ a5i6Y1c9mCsLpb2URTuCahlC3+JeXVp+h3fv8hPl5simEkmSTBVOi4jYeynaLt1oJTlf FaBa47iP2Aohx1eH90b8K10v0vaFSoDgGDeCwENgXIY/ohJtgd5LT+63GtQGAc6DM9Ls cNWnXdnClXNH5HdrqD1pVW4o8xTPMR+otWrqIQC/0nmDKD1gh9D1GnEcsF1pG1lYx1l7 iMbg== X-Gm-Message-State: AOUpUlGc89TgOQ6XJs/roTxP5E0z5IxSUzx0mx5tzZj2t3caNBb+5mk2 /0YN8Imolq3UAYclPs/oJ6zmvVYW5jwbSaJItEE= X-Google-Smtp-Source: AA+uWPzwMXjRS7wr/53Lp9rdNaGjoWtAr6gU3cAYsMC1Mt4RrbB9+MQnn3Rll8Kfn7i6EytBucHX4ovR7n7tfrrU2SU= X-Received: by 2002:a1f:8948:: with SMTP id l69-v6mr11067815vkd.132.1534168626162; Mon, 13 Aug 2018 06:57:06 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Pier Paolo Grassi Date: Mon, 13 Aug 2018 15:56:54 +0200 Message-ID: Subject: Re: separating functions, fpath, and autoload To: TJ Luoma Cc: Zsh-Users List Content-Type: multipart/alternative; boundary="000000000000fcf456057351779e" --000000000000fcf456057351779e Content-Type: text/plain; charset="UTF-8" that should be correct, the autoload will be executed when you first invoke msg, have you tried invoking it? Il giorno lun 13 ago 2018 alle 15:50 TJ Luoma ha scritto: > I'm in the midst of an effort to try to learn some of zsh's more powerful > features, since I've been using zsh forever and feel like I only use 1% of > what it can do. > > One of the things that I've wanted to do for awhile is separate out some of > my more complex functions to remove them from my .zshrc file and put them > into their own files. This should make them easier to track/change/etc and > it makes things a lot easier to read and debug. > > Unfortunately, I can't seem to get it to work right. I'm sure I'm doing > something wrong because I don't really know what I'm doing, so I'll explain > what I've tried, and hopefully someone can explain where I've gone wrong. > > I added this to my .zshrc > > if [ -d "$ZDOTDIR/functions" ] > then > fpath=($ZDOTDIR/functions $fpath) > fi > > The goal there was to add '$ZDOTDIR/functions' to the functions list, which > I think is the right way to do this. > > I can verify that works, I think, by using 'echo $fpath': > > $ echo $fpath > /Users/luomat/Dropbox/dotfiles/zsh/completion > /Users/luomat/Dropbox/dotfiles/zsh/functions > /usr/local/share/zsh/site-functions /usr/share/zsh/site-functions > /usr/share/zsh/5.3/functions > > /Users/luomat/Dropbox/dotfiles is my $ZDOTDIR > > The first file in '/Users/luomat/Dropbox/dotfiles/zsh/functions' is called > 'msg'. For simplicity's sake, let's assume the contents of 'msg' is simply > this: > > function msg { > > echo "$@" > > } > > (It's actually more complicated than that, but that's the overall idea.) > > I tried that, and then I tried > > autoload msg > > and I didn't get an error, but when I check 'which msg' I get this: > > msg () { > # undefined > builtin autoload -X > } > > so I've messed up something along the line. > > Any help would be appreciated. > > Thanks! > > Tj > > > -- > TJ Luoma > TJ @ MacStories > Personal Website: luo.ma (aka RhymesWithDiploma.com > ) > Twitter: @tjluoma > -- Pier Paolo Grassi --000000000000fcf456057351779e--