From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5068 invoked by alias); 16 Feb 2016 08:06:00 -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: 21300 Received: (qmail 6090 invoked from network); 16 Feb 2016 08:05:59 -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, T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=rC/pXBlfImoyIRwQbUh+dRik/df/2rxqclcjkrs3OXE=; b=Y/dGTJG+8eXLNQVlMPMp5TwCGFHFzGuqhRTjyDA2vDa19LALQEBxJM0P7wWVOhH7uM 2kOlGRYGCFhjSkhlzafw4a+ttB7PO1SnG2+R/Y1MxG6yP/9iDLf9Qz5swOM9LPu1aElF HLmejojovowDF6xFdStf5su6kjwsG4JoYlWKJZ5NhzLIwVNxwy7l7c9WGP3+ytotGJ5H vp/CX65plhX00Fpw3w2ecuvrOgQqzLkzMDb9ZVmt7wx22A+gmgbHyJ+1FezD13+wuEgp 7k57QE1aYEBLskLX6hS2Mj5XTRnXOolxiw4aDaTBavQu0nGsTBmwB4wFaLH2ZcT5Y7ih AaDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=rC/pXBlfImoyIRwQbUh+dRik/df/2rxqclcjkrs3OXE=; b=Do9bZ8P/y89gcokSpzi7z5IupmAV5RDWb0BptFPzCn9pT/1ArFUvu7FVhm4uJ2vV0g 27IpMVmBNX+3uwaP1supU0JFT7BcHpgsi9ZgxCwSeWCZdOyVnItq9H3PzzuTOioZnWal pMiNEiy0RxvdgI6SivxtbrwZknR5oZQM+qT8ih4/vscod01ArUUMotR8LxOioRhHO64q AFq2FnUV4cnnUa88f7+NMJxbLlqYuD3yWm1J0AiSTGHHUXD5h+Sp/kOGh4YxKBNro89O 7we9BFRYyHGAto77lRGbvDfRlP7J2RvhF8jtFeMvDKO14/svbZa7zQEbrjN5Y2UNEum8 BJsA== X-Gm-Message-State: AG10YOSoaNHTUwiyegeUD80garoQFAgAN9nfwWdiq/cvkO+ZOs8ehF5CC8w1Fbknq6Fc9u5y7P13H5WEK6A0ZQ== X-Received: by 10.112.138.197 with SMTP id qs5mr5190428lbb.44.1455609955737; Tue, 16 Feb 2016 00:05:55 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <160215205153.ZM28963@torch.brasslantern.com> References: <160215091116.ZM27442@torch.brasslantern.com> <160215205153.ZM28963@torch.brasslantern.com> From: Sebastian Gniazdowski Date: Tue, 16 Feb 2016 09:05:36 +0100 Message-ID: Subject: Re: Truncate $functions To: Bart Schaefer Cc: Zsh Users Content-Type: text/plain; charset=UTF-8 On 16 February 2016 at 05:51, Bart Schaefer wrote: > On Feb 15, 8:31pm, Sebastian Gniazdowski wrote: > } > } Thank you, this works really well. > > As an additional note -- functions that look like > > sample () { > # undefined > builtin autoload -X > } > > should be restored as > > autoload sample Indeed.. otherwise problems that the --reload-and-run function fixed will appear. Or maybe not? Before, we were trying assignment to functions or eval. Here it's plain script body. Wonder how I could test for any problems quickly, will probably leave the issue for a while > except that you can't know which of the -U -k -z options was specified > the first time the name was marked for autoload, so there's no way to > get this entirely right. Looking at define's -f output I have: _a2ps () { # undefined builtin autoload -XUz } _a2utils () { # undefined builtin autoload -XUz } _aap () { # undefined builtin autoload -XUz } ... So it looks like I can have the options by parsing functions body? > The other drawback to this scheme is that you can't save and restore > the "sticky emulation" bits of any of the functions. Slightly acceptable limitation, user will be told "don't change emulate modes". Anyone doing emulate sh will break his session anyway because of for example SHGLOB. That said, the snapshot could cover emulate modes and restore them too.. Best regards, Sebastian Gniazdowski