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, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 24787 invoked from network); 16 May 2022 21:40:39 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 16 May 2022 21:40:39 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1652737239; b=Bnbi/CiaABvWDiJZcfn8nXO+8VdPnLSKDY2hiQ5pB5kff+lcUmgNXK3M6l98fme4veSJi02nU2 cnx0gaFOU4CgOwknQuCB92L+EJGXObFEV7BfO5SwhIGbarhwojAuhdnriPzqquE8DrOB+mCMNA qhCdt46y0Eul8iS4V2gIvUuNCcWZvvMQtwUjgySHkLLJm8ZnrNLHLSoKTEnYkj3baaOaW+1f/z QNQtotKGNx/QH6+1eY8s0MWJglUEfWyC7Ip8AbhsWt/5wy0D0PqvGt9xCeptzhXH6+HPDqLo5N Bd+rNUDtFslgg569Z2gb2hkMlmZZENJCwK5/41PR0b1nAQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-pj1-f51.google.com) smtp.remote-ip=209.85.216.51; dkim=pass header.d=gmail.com header.s=20210112 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=1652737239; bh=ojq6405/BrmSiyCv3M77dsPspw/TLySwMaaCuUZ2hu4=; 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=ly+7bVIEi6ldVVzdZhh4dRpx34vqKkDqp5VuzCdJlflN+5wXgBEjIeroHaZPgLHu65UcdVlWrC Y/aYh4ZJ1ojqpbRQ/oOavnn0HpbLExYsINi3dfxrbBKSO+tnYzgXeUJxBkCn4y/w1qd+EHjALH nMD6Q/WztuJTUo/XirhnYK36KUT8TQtMwuWvgoVET5CZDdxp9Cnd6q8OPxjzRgMrj7utjxG7nk MpbzeireeM2kF1AIYsuChS/Os9A0rCEXO6NsP548IZwRECqw9ipEpUW8GrvU9KFuXe7PXYhabZ dD3+5W8Qr1K3/3W67PQ6Y6mnJBAbJv3XwMXgdxcyLQVM/Q==; 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=qzQiBJejRBhHhMwWiDmTiJwIt4gx4HoyGBK9Dt5ttJ4=; b=UVlNy42pvTcstGl7RjNoMwCGeq 4kWLnqnAqsxGdUubaEvtrMqO65iPl43kQ5rb04h6P0ERHGYCAPZDfM3XAW39cxnBJNFCOlndoTQmi CPTAb0S/e+w7QYro1yacSNpXpLQcOtydNr+iNaX855kmtjaHNL+LxDmnm3Yy3dYH81nQ7BopKVmPS yp8W93zAxRa02EBfrNyfQ+G+xBZna5CPcE60hjMinEuGgd4FI6ch4Kbv2o41h/Qhw2qjJy2jsXie7 WWxlhJsckzDPag3ttYLZDEBrrawB2iFr/UNax86u0sie074MYFAv2X0P8dJbtLJf0rlK49F/0Lun2 ev5F0gsg==; Received: from authenticated user by zero.zsh.org with local id 1nqiSE-000FrP-Bt; Mon, 16 May 2022 21:40:38 +0000 Authentication-Results: zsh.org; iprev=pass (mail-pj1-f51.google.com) smtp.remote-ip=209.85.216.51; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-pj1-f51.google.com ([209.85.216.51]:43886) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1nqiRw-000FWq-Sm; Mon, 16 May 2022 21:40:21 +0000 Received: by mail-pj1-f51.google.com with SMTP id l7-20020a17090aaa8700b001dd1a5b9965so573617pjq.2 for ; Mon, 16 May 2022 14:40:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=qzQiBJejRBhHhMwWiDmTiJwIt4gx4HoyGBK9Dt5ttJ4=; b=gsbFpXA20gwi55aVEwYyNB+gB0PYKhD5F3DQ8f3XlctqnK8FYzQcTPW7woux6okHWQ P/2tl6JPoepDm14DInqWdKJMekhEivLPzgRghaGrnVqgJnNTZZuHSbbLTqPSAFeyUqSO MtonwwqLcNavn2RtZg1ZhGUUK5RZxro/npOBoF1W8BtGoZGMFHC0rdtVs4LtmBMNxHh3 HJYwCga0IZwGSlK25CSxyhLuTRcaAU01BPaSZng7rqZ19HImVZDIzc/G7Yg9PYDQAVQ6 nxgrpDV75dLh51CukpcmaBUsENuqgr41lAxDlgRts4UfWZqveaB1SfTgIzWulUFyrK6v LtwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=qzQiBJejRBhHhMwWiDmTiJwIt4gx4HoyGBK9Dt5ttJ4=; b=F7L6nfp9MfDoteikek8RKwkBaryLx7p1HyzcDAGk+/QEzzy2c8d0563KHC/v98J0t6 83iKYa/EZ3K7OGbZcw4D4gJadQEI5u3HdzYv8LRd/NRNEQkzwyGy3OEvsdn4apFf9Bz1 ZnNHj65wxCcVfoik7JgJZs8931P//O+VbJIMXu0KLEFw2e6Rg5uZVyy2V69cVLPU2knz JA3WZWdHqt9llj9TFwdaNqwAMuwCeTNakhUgShxt9PWKi7bThdu/My9fwciLaYi+K6Qw jof0sXqojiKAXs0w+A2BDok2gY6qMZAxz3vqkYi4IGVQNMEJHHBUj9olm12GZUza8ARS IySA== X-Gm-Message-State: AOAM531gb6ZJYRlmQCQbu+6C9Lm7Xne9Y0LObh3VzS5ns881ie0h5X2u wDdC04Hjo9F+H128IrJriRFR/y0cxXIdeA/H96zsJDJ7 X-Google-Smtp-Source: ABdhPJwu61/xyG+2XR74mQHeAQjVTSws26VNH6yL4hLAaHhk6HdJI6MCmFx3a6806DY/7aKqF1ppLbFCoTATIuEL7RM= X-Received: by 2002:a17:902:b906:b0:14f:76a0:ad48 with SMTP id bf6-20020a170902b90600b0014f76a0ad48mr19933099plb.79.1652737219509; Mon, 16 May 2022 14:40:19 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a05:6a10:e897:0:0:0:0 with HTTP; Mon, 16 May 2022 14:40:19 -0700 (PDT) In-Reply-To: References: <20220515152021.pumg2z3fmfga76vp@asfaloth> From: Mikael Magnusson Date: Mon, 16 May 2022 23:40:19 +0200 Message-ID: Subject: Re: man completion To: Bart Schaefer Cc: Karel Balej , Zsh hackers list Content-Type: text/plain; charset="UTF-8" X-Seq: 50238 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: On 5/16/22, Bart Schaefer wrote: > On Sun, May 15, 2022 at 9:45 AM Bart Schaefer > wrote: >> >> The completion function is calling $(manpath 2>/dev/null), but it's >> caching the result, so if you change $MANPATH that's not being picked >> up. >> >> It also clobbers the cache if called with the -M or -m options and >> doesn't reset it, which is clearly wrong. > > Here's a patch that attempts to (1) skip the cache entirely if the -M > option appears and (2) assure a cache miss if $MANPATH has changed. > > The question is whether it's worth this much effort to avoid running > $(manpath 2>/dev/null) every time. > > Also ... I didn't change this part, but doing ${(s.:.)...} twice seems > redundant or even potentially wrong? > > + mp=( ${(s.:.)$(manpath 2>/dev/null)} ) > + [[ "$mp" == *:* ]] && mp=( ${(s.:.)mp} ) As far as I'm aware, it should be impossible for this condition to be true since (s.:.) on the first line will have removed all colons already, unless you somehow have IFS set to : without breaking anything else. -- Mikael Magnusson