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.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 16168 invoked from network); 15 Sep 2022 19:08:33 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 15 Sep 2022 19:08:33 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1663268913; b=A/3Q70Po6S2+zlHKes6trIC+zPYzWeDRuJ+Ckq1aaXZ6hIXdJTZyaxNfibufxHH/w95OWNaMWg OkY5hqrvvlLYlHPoyRUxFztk+hyrVbWC7jxs4dOWHMrveY67GsEKU5dF52vKg3i+8gvLFij0Ip wwbB9OP5vdnLyu+EGbxUiXwGD40RHouaCFxlUf+cNmNd92vcFlxXdTf0czqCA7KhYattpQHEJ+ NhlaENlnd17z5gjGNjDZHrTeEeFlytOUquzj0Gp+5hUTrrA3dGHtbsunuF5AtEgITlSeUsDW6G X/PL3H7i/j7j8Jws2xrSIowhhO3RUhMLbGTcROpcsUeXsA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ej1-f50.google.com) smtp.remote-ip=209.85.218.50; dkim=pass header.d=brasslantern-com.20210112.gappssmtp.com header.s=20210112 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1663268913; bh=g1EIP5TeTNY4jhEgN2tf6E1ChVOGPqH3us4lo2DZ/o0=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=CRt9uzN5f7TW2V5Orwf7JLwfia63MS4O0UjYG9IcsvldN85twIs6fMs7Ce+gvMdBkA02KpnLL0 PiH2TUQbP3OjSN9NDN26Yinu3mLihBXfK/+vBjibsiEEnQPmtCU+QMED27SuaQYBBBo5CfX4DO 6YFqcaL+5FyDObbsoYXCvBVqFAj8NQXxoml3RxenyuM3FLMou3lhdQXnvV8QYoqy5xSQD1owop fuDxx7tQ7PddrZHJ2lkuoOk2yh19Pbi4eHDjgHAbleJmm+jE12RqrO5sdGqtC218wC3kbYha/I OOHpt2yec4fdXviaNQq/uAWWiLmxeqstzRJ06NtS6IOMRA==; 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:To:Subject:Message-ID: Date:From:In-Reply-To:References:MIME-Version:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=C4+Mqs3kE8fGqVoe58dPjeGaEEd5Qp6SXU26zwrIbaM=; b=ciGZyoCspa4J+lZoB6O6BmtZzl xoIYeL9FSLhN5bPaifKhLVLVySsqZgESw+miV7hTUbrJ5fE7avdj6YTtyYX7bvGC0FiBSylM6FxoS +VSNC4RiIcSzM8pn3r4dLKzgRSNiOIpyWjd062kKizzF3Q8CWKq79QUMlTM4GPqjzfPfrTnePuIBU CknQXoeSTOCJiLdLX0pAYHSiebfWe3mjA231ubrKdOFil6frccIucvdScn+xzDDPwtpgea+js/heI 0ZUhULRQ9gTA9LtZVqI9BPeYl20sxLwYVUnHp4p9rp/R+0cN1d+2eLGMJprPp0QchutCaaOQ49Fsy 2Q8lbtsw==; Received: from authenticated user by zero.zsh.org with local id 1oYuDw-0001cX-UM; Thu, 15 Sep 2022 19:08:32 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ej1-f50.google.com) smtp.remote-ip=209.85.218.50; dkim=pass header.d=brasslantern-com.20210112.gappssmtp.com header.s=20210112 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-ej1-f50.google.com ([209.85.218.50]:41901) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1oYuCn-0000tm-Nj; Thu, 15 Sep 2022 19:07:23 +0000 Received: by mail-ej1-f50.google.com with SMTP id d1so3484254eje.8 for ; Thu, 15 Sep 2022 12:07:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20210112.gappssmtp.com; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date; bh=C4+Mqs3kE8fGqVoe58dPjeGaEEd5Qp6SXU26zwrIbaM=; b=h6kVUJ7Xxd76WhEKOmxFevs1JqLyoOniPCBQLtRQwAABpBKy6XyUlEnxFToZ5S1KCk L3oDKljLrru9aEOsdSC/jJhVRKUs5HLIR5AiMSGcejddqcpKhm9MHwdbMDds5D9hZ9PA qS11DKpNezPb7/zy75W335Q21x+OHwHlEEn/UpaDaBqn3kg3lIMYZbzi30DmLzrdd/Ab RiLbFK1NhC7jYZK8jYp0FKmHQcqBAupH7uPoPN3WI0OUDZbly+tUJlB6ih7AMs8Zn8bx 5Rd95UQx/Xg+9xOcI6OieWxRg8EX3jyH6dnO6wtPLROFCc/QOzX1+x37kgI28GLReEhe ARGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date; bh=C4+Mqs3kE8fGqVoe58dPjeGaEEd5Qp6SXU26zwrIbaM=; b=Fd9tdFzgH86ONd5sd7mOVXMe+WMTSwwO+3BIMq3o5OQR1vbjb/bF1+GoOvbMJ0xUXt pdyE/31WXufkoqGzGAasMYGlwmjeVmgJYjV/QQv96ojZKuo4yEErFdv+7S8TKI1VzYld KShAHc0c2RFrfCpVMdUDnKJlfuaKldseKJsZusTwfMi8VCxP0COZ5gAw7CvjpxmI57sc EbMvE0zzIj5SRFBy3I+pqhzv+g74IQbatGSnclGuMN5jWHNGPqZW2VbOQ9JzbPMof3M6 lVjBrUkvJcEFqAaUrsQIx/uuCtCf0iAD904sDLCnEK5YgUaX48G08MRkwsAg5Gs0on0i aonA== X-Gm-Message-State: ACrzQf0bFUwp5enrlMf1+KCSmp3WionquJCvn6jOVuqsUhF/+7ge3KBU 9rZZhWayLRKjDaOqxs7wdi2sDkvZeu8shheZxb3kBa6EIvU= X-Google-Smtp-Source: AMsMyM5oC82h58E0UEPfN12PQlcdJAL2nTLBPn7U0QccQ0GJI7at2eUydjQLKDsqrxvACSJZ8K2J8rLWM1gR6tlwOZ4= X-Received: by 2002:a17:906:9bd3:b0:76f:8cce:7a61 with SMTP id de19-20020a1709069bd300b0076f8cce7a61mr937435ejc.345.1663268840808; Thu, 15 Sep 2022 12:07:20 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Bart Schaefer Date: Thu, 15 Sep 2022 12:07:09 -0700 Message-ID: Subject: Re: "rehash" but for autoloaded functions To: Zsh Users Content-Type: text/plain; charset="UTF-8" X-Seq: 28086 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 Thu, Sep 15, 2022 at 10:24 AM Zach Riggle wrote: > > Is there an equivalent to "rehash" for autoloaded functions? Presumably you mean functions that have already been loaded once, and you want something to pick up the changes from disk? Unfortunately once the function is loaded, there's no direct way to determine HOW it was loaded. You can find the file from which it was loaded, but not whether that file was read from fpath or directly sourced. > It's fine if they revert to being not-autoloaded-yet, just looking for a simple solution other than "exec zsh -il" to get this effect. But "not-autoloaded-yet" does mean still marked for future autoload, right? > I expect I can write something to this effect with "$functions_source[pip]" and compare the ${filename:t} to the function name, but I expect there's something for this already. If you already know the name of the function(s) you want to "rehash" this is easy; I have a little (also autoloaded) function: reload() { unfunction $* ; autoload $* } The tricky bit (where you might be able to use some sort of heuristic on $functions_source) is finding the names of all functions that need re-auto-loading. This is more delicate than "rehash" (which simply discards the entire command table) because you have to avoid "unfunction"-ing anything that can't be re-"autoload"-ed. That "reload" has been unchanged since zsh2.4, could probably stand updating for some of the new options available to autoload.