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,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 2772 invoked from network); 9 Aug 2021 13:37:18 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 9 Aug 2021 13:37:18 -0000 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:Message-ID:Date:Content-ID: Content-Type:MIME-Version:Subject:To:References:From:In-reply-to:Reply-To:Cc: Content-Transfer-Encoding:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=emUeaKQAXNXzmHT4iEv0iNR3Kbl2J1H+xKSn9TUbvfE=; b=WG3Fehd1LMicNrN0K82+8SDMv7 nLrhpcdcmPhmJyjAmlqzao5Ls7/bpgNT62EM64fpXe7Y2TCA48+SdQQgrIZORj7CNOGEyUppCgtxq Em2phjYMvosC3nxkeSB/8silc3/f4GtF97Bu7g4iQYEhN6rfjFFKvzdqhMVFEXyGbi3eJxv0ivpTk fawrA99OjUv2nFSOp6ysXka6Pr0m8enzuOKv3uX8qN/ipaPorUmGjugx9E4NuyvMVURprPK7Fg8gq 0jB1X7gSIAX4c5wV1GsbfE9KvOZ+i3Ipc+o1Efn7N0qXZzHw46srXKaSv+IzrAO8U2e5GjQSwkigQ 7YiBcPYg==; Received: from authenticated user by zero.zsh.org with local id 1mD5Sv-0007hF-JA; Mon, 09 Aug 2021 13:37:17 +0000 Received: from authenticated user by zero.zsh.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1mD5Sd-0007Mg-Pg; Mon, 09 Aug 2021 13:37:00 +0000 Received: from [192.168.178.21] (helo=hydra) by mail.kiddle.eu with esmtp(Exim 4.94.2) (envelope-from ) id 1mD5Sc-0006Ge-O6 for zsh-workers@zsh.org; Mon, 09 Aug 2021 15:36:58 +0200 In-reply-to: <20210808155804.v7di4mpoyyis7h4k@chazelas.org> From: Oliver Kiddle References: <20210801160547.zf37spd5ui7dfj4a@chazelas.org> <20210801162439.nfs6b7v6i2c6luqw@chazelas.org> <26560-1628150003.918228@jgeh.uisY.RfGy> <20210808155804.v7di4mpoyyis7h4k@chazelas.org> To: Zsh hackers list Subject: Re: info completion doesn't offer index entries any longer MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <24094.1628516218.1@hydra> Date: Mon, 09 Aug 2021 15:36:58 +0200 Message-ID: <24095-1628516218.744330@eGij.Ns0X.qUzs> X-Seq: 49268 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: Stephane Chazelas wrote: > > There is no actual attempt to complete anything for --index-search= > > What do you think we should do there? > > Well, I was hoping zsh would give me similar completion as > info's i would. ... > Doing the same as i's completion may require parsing the contents of the info > file directly. We may be able to use the search for an empty string approach again, e.g. info -o- --all --index-search='' zsh The patch below tries that. You need to specify the manual first before --index-search but for 'read' in the zsh manual I get a similar list to the i command in info. We could perhaps drop the info -k '' method in favour of this - would need to compare results for a variety of info pages. In the patch here, I've made it include in the part to the right of " -- " too so it is generating more matches including the "info zsh read" case we started with. > What I mean is that I'd expect info -k '' would only need to be > run once within a single interactive zsh session. When I > instrument it with > > info() { echo info called>/dev/tty; command info "$@";} > > I can see info being called each time I complete info zsh something for > instance. In my testing, it is running info -o- zsh each time but not the much slower info -k '' If you include "$@" in your instrumentation function are you able to confirm that? This is because both menu and index items are allowed. Oliver diff --git Completion/Unix/Command/_texinfo Completion/Unix/Command/_texinfo index 2122a70ad..526a595a8 100644 --- Completion/Unix/Command/_texinfo +++ Completion/Unix/Command/_texinfo @@ -37,14 +37,14 @@ local -A opt_args infodirs case $service in info) cmd=${words[1]} - _arguments -C -s \ + _arguments -C -s -S \ '(-a --all)'{-a,--all}'[use all matching manuals]' \ '(: -)'{-k+,--apropos=}'[look up string in indices]:search string: ' \ \*{-d+,--directory=}'[add directory to infopath]:info dir:_files -/' \ '--dribble=[record keystrokes]:file with keystrokes:_files' \ '(-f --file 1)'{-f+,--file=}'[specify Info manual to visit]:info manual:->infofiles' \ '(: - -h --help)'{-h,--help}'[display usage]' \ - '(-o --output -O)--index-search=[go directly to node if found]:search string: ' \ + '(-o --output -O)--index-search=[search for matching index entry]:search string:->index-entries' \ '(--index-search -o --output -O)'{-o+,--output=}'[dump selected nodes to filename]:filename:_files -g "*(-.)"' \ '--init-file=[specify initialisation file]:file:_files' \ '(-n --node)'{-n+,--node=}'[specify nodes in first visited Info file]:node:->nodes' \ @@ -302,6 +302,13 @@ if [[ -n $state ]]; then tags+=( info-nodes ) fi items=( ${${${(M)${(f)"$(_call_program menu-items info -o- $file)"}:#(#s)\* *::*}%%::*}#??} ) + elif [[ $state = index-entries ]]; then + if [[ -n $file ]]; then + tags=( index-entries ) + items=( ${${${(M)${(f)"$(_call_program index-entries info -o- --all --index-search= $file)"}:#(#s)\* *:*}%%:*}#??} ) + else + _message -e index-entries $state_descr + fi fi _tags $tags @@ -309,6 +316,7 @@ if [[ -n $state ]]; then while _tags; do _requested info-files expl 'info file' compadd $suf -M 'm:{a-zA-Z}={A-Za-z}' -a files && ret=0 _requested menu-items expl 'menu item' compadd -M 'm:{a-zA-Z}={A-Za-z}' -a items && ret=0 + _requested -x index-entries expl 'index entry' compadd -M 'm:{a-zA-Z}={A-Za-z}' -a items && ret=0 _requested info-nodes expl 'node' compadd -M 'm:{a-zA-Z}={A-Za-z}' ${nodes#*:} && ret=0 (( ret )) || break