From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id fc02f3bd for ; Sat, 4 Jan 2020 01:16:30 +0000 (UTC) Received: (qmail 14459 invoked by alias); 4 Jan 2020 01:16:22 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 45226 Received: (qmail 26367 invoked by uid 1010); 4 Jan 2020 01:16:22 -0000 X-Qmail-Scanner-Diagnostics: from mail-yb1-f195.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.1/25677. spamassassin: 3.4.2. Clear:RC:0(209.85.219.195):SA:0(-1.9/5.0):. Processed in 1.731632 secs); 04 Jan 2020 01:16:22 -0000 X-Envelope-From: dana@dana.is 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.219.195 as permitted sender) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=hiLC7371awMc3RgzZ47A6J9Q139TND0eiDfr0bTa4nQ=; b=mkNnaGpjR0TTrQ4lYChphhKqlFCgWTNWMV2r7m4a+t+R8tB27WL++Y8AC/HDvCw9NL MVhhV/z5wP8upCqQzXlcrI+75APB44jdJfGXLrujrIjJL8UI93AzbKVeGaTzgP4Vy/PB xb+AfiXlhojldj1qB+roHFdi2WkJ5GrsVARcKbfWNMqh+jyi8ZfqqZo4ZK34mQ8Q35o2 OpsIt84anYBYS2pU3c7H8YbYhU9SzHTrACNwwrX7AdHTmm5tYN4wewuEFlN3oWilFCk1 SrHKV2V74qwUX8HjNrNX42g7z61H57+54Qu0jWsJ5Xef/9QFT1oyomIYkjiCvke3q4XV 0hZg== X-Gm-Message-State: APjAAAXoBnrMZDyMunhaPz96PNzxJ90ZpRXE7BBr8z+6gMGR2e5GtVcJ zCTTutK00mYDqrFO/UmrhrEAvnhFNglsjQ== X-Google-Smtp-Source: APXvYqxZ0CTXDGsNnPwF4aH98QWhZlBOaKTWp4gXicalgL0r8q5Yx0ngBIsNSS5tMqdP4lv72zZfOQ== X-Received: by 2002:a25:7cc1:: with SMTP id x184mr70006828ybc.69.1578100547530; Fri, 03 Jan 2020 17:15:47 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: [PATCH] Improve _man file-path completion From: dana In-Reply-To: <20200104003913.3gq5hnlmhndwbzz4@tarpaulin.shahaf.local2> Date: Fri, 3 Jan 2020 19:17:56 -0600 Cc: Zsh hackers list Content-Transfer-Encoding: quoted-printable Message-Id: <07B00625-9EC2-454E-B3E0-6F520DE4A899@dana.is> References: <83C0ABA0-99A5-4DAD-98D6-DBB919F61E24@dana.is> <20200104003913.3gq5hnlmhndwbzz4@tarpaulin.shahaf.local2> To: Daniel Shahaf X-Mailer: Apple Mail (2.3445.104.11) On 3 Jan 2020, at 18:39, Daniel Shahaf wrote: > How about this (relative to master)? It fixes your original problem = but > retains the separate-sections behaviour for man pages specified by = filename. Oh, that's much smarter, thank you. I do see some minor issues with it: * It creates a confusing inconsistency where it will automatically = complete directories in the CWD, but not files (because files still need a / in = the argument) * It offers directories first, which i think will be annoying in the = more common case of trying to complete a man page from the database/MANPATH * It offers to complete paths unconditionally, which isn't actually = supported by some man implementations/modes (OpenBSD requires -l for example). = We were just assuming that the user knew what they were doing if they had a / = in the argument, which i think is probably still sufficient * Plural description How about something like the following, then? On 3 Jan 2020, at 18:39, Daniel Shahaf wrote: > Aside: > > % compdef _f f > % _f() _files -/ > % f Util/ > . > offers files, rather than nothing. Bug? I seem to recall this being discussed before, and it isn't really a bug, = but we could change it if we decided to. Someone was complaining about it on = IRC just the other day. I think we'd simply need to remove *:all-files from pats=3D(...) dana diff --git a/Completion/Unix/Command/_man b/Completion/Unix/Command/_man index 41ae85a1f..7d55201e3 100644 --- a/Completion/Unix/Command/_man +++ b/Completion/Unix/Command/_man @@ -381,7 +381,12 @@ _man() { =20 (( $#sects )) || return 1 =20 - _tags manuals.${^sects} + if [[ $PREFIX$SUFFIX =3D=3D */* ]]; then + _tags manuals.${^sects} files + else + _tags manuals.${^sects} + fi + while _tags; do for sect_dirname in $sects; do d=3D$sect_dirname @@ -390,6 +395,8 @@ _man() { _requested manuals.$sect_dirname expl "manual page, section $d" = _man_pages && ret=3D0 done + [[ $PREFIX$SUFFIX =3D=3D */* ]] && + _requested files expl directory _files -/ && ret=3D0 (( ret )) || return 0 done ## To fall back to other sections' manpages when completing = filenames, like