From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8873 invoked by alias); 19 Apr 2017 20:57:27 -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: 22681 Received: (qmail 1460 invoked from network); 19 Apr 2017 20:57:26 -0000 X-Qmail-Scanner-Diagnostics: from mail-ua0-f174.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.217.174):SA:0(0.5/5.0):. Processed in 0.925192 secs); 19 Apr 2017 20:57:26 -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=0.5 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RCVD_IN_SORBS_SPAM,SPF_PASS, T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.1 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.217.174 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=k8MvGpg995N1WJ4x1NovG9eOcT96Mklgtegi4WIbJzk=; b=TBsw3ARZHUHamz9HN+KVA1gsLfYzQ5KhJfITXC5pDUahWIMQ9yfefih6nt1Ui3Dwg1 J2keM6yt9oBuBbzheAypnue8z8ePZMeaPAZlLWO8l/8muNobl6B5yJnhmBV3JCXjFyix USR2Z856etlYcybf+XeUE4FwPJlQ9FFBBz4QzalUcp7E10Xa3h5buuD59QdB5Tqw04Go yJWTF8Nxw8z4zE8GNc8iQUfFyb7u4HEKK266jzDkhAoJEGos9u95A4sL0pfNbWCfHrS3 d4WGsmDdziyRGpu5gOwp8vjmx5r05Ge4Qqv+vmyEM497aHDxNc4qslZPUvqt5daAOpJ1 k0dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version; bh=k8MvGpg995N1WJ4x1NovG9eOcT96Mklgtegi4WIbJzk=; b=IRIm8OV+r2vauIpSs7qYS8lT9k0wrLS3PIGHeds6AMIHnH0SUEMlQmL9Fatssy+I3h vpyaE/pbxRUHP4U3q3NpmMZMDy3LfzY6Isb1DaWjEjoUd/SrkUHEIh+lmBgnOuVfS223 P+KfE9z+SwRBhygV84GXcsCeVRYwYC2t57UY7w1Jfq5zS0MZR+Mx8HdGkqb5/ILVxJa8 2o3jdugUfso9VS2GuZNuGIfTM5R/T45HrZkiqeUpWhdE1OaQleatm6XY9cteopCrqFFW 2i66XMViS0gooyziuRpP8K2IPpbsXSR+4P979QNsZ/CthVvGybgjdIyDWIFWNa/K734L rqhg== X-Gm-Message-State: AN3rC/4XwuIIiTHIUIvaATL4LKUrZCpKdayXA3Q8wEFyddDXigwAeI+W IEAz3lBSfCS2ayFl X-Received: by 10.31.84.194 with SMTP id i185mr2054512vkb.69.1492635440769; Wed, 19 Apr 2017 13:57:20 -0700 (PDT) From: Bart Schaefer Message-Id: <170419135755.ZM32067@torch.brasslantern.com> Date: Wed, 19 Apr 2017 13:57:55 -0700 In-Reply-To: Comments: In reply to Sebastian Gniazdowski "Hooking up to function definition via module" (Apr 18, 10:23am) References: X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: Hooking up to function definition via module MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Apr 18, 10:23am, Sebastian Gniazdowski wrote: } } So in theory I can analyze setopt arguments in bin_setopt2(), record } which option is being set, even if it is already set to requested } state, then call original bin_setopt(). Yes, but -- options can also be changed as a consequence of "emulate", even long after the the emulate command has come and gone, because of "sticky emulation" (emulate zsh -c 'myfunc() ...'); and there is a moderate list of options that either can't be changed by setopt, or that can't be unwound by localoptions. } I think I cannot do something similar with function } redefinition/definition, because there isn't a builtin dedicated to } this, so I cannot wrap that builtin. But maybe I'm wrong? You are correct -- function definitions are handled entirely by the parser, there is no table-driven lookup that you can subvert. Depending upon exactly what your goal is -- I'm guessing it's to make a module for your plugin manager -- you might be able to do a lot of the work with a function call wrapper. See zprof.c for an example. This is getting into zsh-workers territory rather than -users.