From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 22092 invoked from network); 11 Aug 2021 18:26:07 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 11 Aug 2021 18:26:07 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1628706367; b=SO9ELmaZoEF1z9cQ+n/l9VqTeS5/xOJTPJ52t3+2rtcNS+hSA0IFdRm+3T9SeLbViQuLSWSddr Sx619xAlEsonM7l2V4Mu/92fMy635Tg290UEZIsFRdkGdBwQhM2UHVh4nGnU/bpp2m8z/wmgrI x73+zFtlnJ+USWmwVaXaYuxcL/Ar/yy9EJGbgeZqXcA9jLs3cdP3+yspAB76zhxNqBqBxqEo71 3W/Ug+bo5OX+fXPZ0ZwRkrZNTKQBdfgdl83ToHMUHlFRqPPhXP1neFxLFg+RPlSvnvNqe0UdHI x5NFgW4IVG1XFCBEW1zzccLoJWejzA2DXzp90ZdWc7kDew==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ua1-f45.google.com) smtp.remote-ip=209.85.222.45; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1628706367; bh=3HNAyRLuV76x9Jl31DONHELXW5la8PP+21emS5IH1PY=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:References: In-Reply-To:MIME-Version:DKIM-Signature:DKIM-Signature; b=pz4hhh8xeay1A+5ThFFvHJHwfvyo5KrfIv2TaFCmBKAYG7Y/rckpw/25X8s2BduP4Tua0hwMac OT+am7EAi7RHL9BSuxxVQ1E8h2Pu3BFg9yaCorwIQtrtyXuOShds9ifUJY0EWbRb0eSiP3pfBa 1ge2VcU2Z70NXPQ+DkZXun7rszM21oVUIZUWbwWHAVw+gJetutpNi8xo+l73wC9YxJp/C6rmzN wAzA3t6IYRQHHR5oSZBxyLOHN3R0feI/H7CoV84TpUpafiIwvokjRV3uIued+shsqLc+9Ria52 TJj8gncFDmX7dUuNyJvxLr0pVOZIVKR09SWyoAAAgfVg/w==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID :Date:From:References:In-Reply-To:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=droOgYZqtlKzlMtiLls96nvbo8RvpuTyjWq26gXN9iI=; b=KrR/YYyZqLrEgtrK4WvX+QQm/H W2vxwzh6ApwoZviI5RMtrQa+Ev25EpXbh3L79GJf1xZQqSHt9nnG9q6RFVfFugzOCmd80Nc74g8Dt BRzxr29fl8DD2zqRFfwLQB/4TO2VuR++9z05vDpJ46DnZdnDzUbMrll6M9G5HXAnd2+2QZ44XQCYG fCyWcAIowCVu51le7EKlVMbATqXZoyj7pwwovBG6Uch0xs9WY+AnstkY+0VcfP2xnBempcm8gN91Z aWSHDfSoInbXfsqLxeKoIY5Gp8G50FqrZokAXNmenoIyFjbmp8K+k5ivRE71BSMRRDo8rI/27YfwD XkBChELQ==; Received: from authenticated user by zero.zsh.org with local id 1mDsvW-000HG6-L0; Wed, 11 Aug 2021 18:26:06 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ua1-f45.google.com) smtp.remote-ip=209.85.222.45; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-ua1-f45.google.com ([209.85.222.45]:39540) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1mDsus-000GUs-UO; Wed, 11 Aug 2021 18:25:27 +0000 Received: by mail-ua1-f45.google.com with SMTP id a4so1601622uae.6 for ; Wed, 11 Aug 2021 11:25:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=droOgYZqtlKzlMtiLls96nvbo8RvpuTyjWq26gXN9iI=; b=QyhDfmHO6KYoWYbvMjEa18YIRwhe+phEw3x7XqCD1HhbnNhCGf7WVcTMDwRs362at+ F42wcfDwh1FyTqjReg9EBBhkKfgDG0Yu2DGQry8U7LaI0ylvzD/zI7Anl3UK372KWyAA 4FzZY/PdPDjYOh+S7ZR5s66s6p7bejqsDnsgzrztZH49525s+vkakwJfxR4uoOw8B0Ko h3Qe6k/OvPZnl8tmVPsVE4GC0R6Z1HURinYANf5H66wfCjEUvMqF7lZHUwBS/Do2xYAd g5mA1+iMEa3SJ4wdZWCWQWJqd6sR7rCRsAT4B6sEnm5gxQw+0cOjutz0wmHvsgVfDMvQ vC3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=droOgYZqtlKzlMtiLls96nvbo8RvpuTyjWq26gXN9iI=; b=hjDROnkPhxVS/hpPmKMmYKGSd1Lj6dGVtza9rJgeXv8HNzVhPSHKsqSlOzKZa7pOn9 V4kQul8FnQVtUafFcgoIwtPHFfTALIoYgcPr3My06SvoCMUb6M2ID3zhRA5nUF+xOpiF x4zI97PI1QaxAp+DtdJmHpkuzNuNJ548RUdWY243yBAGYqop41LRPTwEQF3F871DR3AK Vn+bwbI2Y93/oead3VacQFVcrZYYdkq+uFz5ODGIyLYTorjgnFqlW+hwaUEJfRBo2Hbh WsFt4sijUE+0o1Zz8vh9aRxHdclQE4iGhDzJ7tuW3XYLHzeCkqfhlRU+5yza/ULjOjiJ je2A== X-Gm-Message-State: AOAM532so/N0hIyoQOCopzXAMndIAx7WryTwj/dPvD1Yk4ymJpU8+24t CjWhctn2UW5AeL2ajcVkBbrmlbD5OXxfUtkXtCY= X-Google-Smtp-Source: ABdhPJzospWM/46kH+c7AFx/D+bycI3mYiUrvz5d2E1Y7l6Mx3oENHEi7rAYKvmTPMC0g/ZPvY8EUXp1CCQ8SBkPrAg= X-Received: by 2002:ab0:849:: with SMTP id b9mr174242uaf.43.1628706325901; Wed, 11 Aug 2021 11:25:25 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ab0:1508:0:0:0:0:0 with HTTP; Wed, 11 Aug 2021 11:25:25 -0700 (PDT) In-Reply-To: References: From: Mikael Magnusson Date: Wed, 11 Aug 2021 20:25:25 +0200 Message-ID: Subject: Re: Re-loading files loaded via "autoload" To: Zach Riggle Cc: Zsh Users Content-Type: text/plain; charset="UTF-8" X-Seq: 26913 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: On 8/11/21, Zach Riggle wrote: > Hello all! > > Thanks in advance for my spam. I recently spent some time spelunking > in the Zsh docs for how to get an "autoload"ed module (sorry if the > terminology is incorrect) to be re-loaded. > > It appears this is possible, but not well documented. > > Specifically, "unfunction" or "unset -f" work to permit the "autoload > foo" to run again, and re-define the various functions declared in the > module. > > What's the appropriate venue to ask for documentation updates, since > this should likely be in the documentation for [1]. > > # Homework > > I looked at the documentation page for autoloading functions [1] as > well as the page for the autoload builtin itself [2]. > > As always, SEARCHING the man page / info page / HTML pages are > difficult, because it's not possible to scope the search results to > "just this section here" so searching for "remove" or "reload" shows > lots of unrelated hits. > > Because "autoload" has its own page, the behavior of unfunction / > unset -f should probably be documented there. > > [1]: https://zsh.sourceforge.io/Doc/Release/Functions.html#Functions > [2]: https://zsh.sourceforge.io/Doc/Release/Shell-Builtin-Commands.html > > Zach Riggle It is implied in some places that you can do this, but perhaps it is worth mentioning explicitly somewhere? eg, we have this, which mentions it in a comment of the example code: It is also possible to create a function that is not marked as autoloaded, but which loads its own definition by searching fpath, by using `autoload -X' within a shell function. For example, the following are equivalent: myfunc() { autoload -X } myfunc args... and unfunction myfunc # if myfunc was defined autoload myfunc myfunc args... But then this introductory paragraph for the autoload builtin: If name consists of an absolute path, the function is defined to load from the file given (searching as usual for dump files in the given location). The name of the function is the basename (non-directory makes no mention of the fact that this is not true if 'name' is already a defined function, and it also doesn't seem to mention it in any of the subsequent paragraphs. -- Mikael Magnusson