From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27104 invoked by alias); 30 Sep 2015 04:03:45 -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: 20664 Received: (qmail 25661 invoked from network); 30 Sep 2015 04:03:44 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=G5R6NEqcqHGibTaRD82oeD8+gfXrtGNZGvFC3NOmylE=; b=llqgpVxmnS+RqDm6NuDWjMKNDuPYQTCs+JV/pIM/IiyQlda1kgjhgISzN+fx+DqBAq IEVosb0+WBoiwjTKZb0chfUf/PE2iAqCN+EtfnM33JlFeMz/m1VOBvic7HrAnTUMRAgb r/DTH785d6HQMHgvvxglwV8d/mlu7JXWCuv9fPn4GQSUhBquIjNf3ycZR8OIMwETaqfY juvYpgAxw4EDFd4lKneqA09XXGSWLxbazDXME0kdiHLRJroDML0Wjc0Mfjtc3mUCBqie Iq6OHPTUjGFaAUNQAKsLp2SPqZFwd61qLvvcWrA/F+3IZO04ESoZKCFmLXnFa7GlhimG CBag== MIME-Version: 1.0 X-Received: by 10.55.55.68 with SMTP id e65mr1732668qka.24.1443585821836; Tue, 29 Sep 2015 21:03:41 -0700 (PDT) In-Reply-To: <150929204047.ZM9646@torch.brasslantern.com> References: <55FAE223.2080502@eastlink.ca> <150917103419.ZM10067@torch.brasslantern.com> <150918171441.ZM27212@torch.brasslantern.com> <55FD7982.9030505@eastlink.ca> <150919092922.ZM28214@torch.brasslantern.com> <55FDA5D3.9020304@eastlink.ca> <150919142243.ZM23634@torch.brasslantern.com> <55FE04AD.1070304@eastlink.ca> <150919224120.ZM4736@torch.brasslantern.com> <55FF3F7E.4060906@eastlink.ca> <150920211840.ZM31871@torch.brasslantern.com> <5600386E.7060201@eastlink.ca> <150921111746.ZM388@torch.brasslantern.com> <56006401.5060902@eastlink.ca> <150921201943.ZM707@torch.brasslantern.com> <560B1BE7.8020507@eastlink.ca> <150929204047.ZM9646@torch.brasslantern.com> Date: Wed, 30 Sep 2015 06:03:41 +0200 Message-ID: Subject: Re: wheels within wheels From: Mikael Magnusson To: Bart Schaefer Cc: Zsh Users Content-Type: text/plain; charset=UTF-8 On Wed, Sep 30, 2015 at 5:40 AM, Bart Schaefer wrote: > On Sep 29, 7:55pm, Kurtis Rader wrote: > } > } In short: don't do it. > > That's a bit too short. Nesting function definitions is exactly what a > lot of autoloadable functions do. The difference is that autoloadable > functions also redefine *themselves* this way, to change what happens > the second time the "same" function (in name only) is called. Another example where this is needed is to do this: function _zle_line_init() { zle set-local-history -n 1 function _zle_line_init() { # do whatever it is you actually wanted to do in zle-line-init here } _zle_line_init } Ie, to set local history by default when you start the shell, because it has to be run from within a widget, but you may want to toggle it while running the shell so it can't stay in the line-init hook. Therefore, do it the first time, and then redefine the hook to do something else. -- Mikael Magnusson