zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: zsh-workers@zsh.org
Subject: Re: [PATCH] update _ps (with question)
Date: Wed, 06 Sep 2017 14:26:03 +0200	[thread overview]
Message-ID: <20455.1504700763@thecus.kiddle.eu> (raw)
In-Reply-To: <68D6FE10-4636-4582-AC2A-1FB0852EAC28@kba.biglobe.ne.jp>

On 2 Sep, "Jun T." wrote:
>
> if [[ -z $pids ]]; then
>   _pids && compstate[insert]=
> fi
>
> Why compstate[insert] need be reset here? If it is reset, then
> nothing is completed by 'ps <TAB><TAB>...'

You can remove it.

It is reset because _pids sets it (depending on insert-ids) to menu
and we've got BSD options mixed in so _pids setting it is not as
appropriate. I've just experimented with it a bit and it's a bit tricky.
_pids doesn't really have wider knowledge of what other matches there
might be (aside from $compstate[nmatches]) so it is hard to have it
adapt to that.

'ps <tab><tab>' gets me menu selection. What do you have insert-ids,
menu and tag-order set to for this context?

Following patch is a totally unrelated minor tweak for ps completion on
Solaris.

Oliver

--- Completion/Unix/Command/_ps	2017-09-06 11:48:08.927796173 +0200
+++ Completion/Unix/Command/_ps	2017-09-06 11:49:04.773755213 +0200
@@ -226,8 +226,9 @@
 if [[ $OSTYPE = (*bsd*|darwin*|dragonfly*) ]]; then
   compset -P - && pids=1
 else
-  _arguments -C -s $args '*:: :->rest' && ret=0
-  [[ -z "$state" || $OSTYPE = solaris* ]] && return ret
+  [[ $OSTYPE = solaris* ]] || args+=( '*:: :->rest' )
+  _arguments -C -s $args && ret=0
+  [[ -z "$state" ]] && return ret
 fi
 
 _values -s '' -S ' ' 'options' $bsd && ret=0


  reply	other threads:[~2017-09-06 12:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-01 16:03 Jun T.
2017-09-06 12:26 ` Oliver Kiddle [this message]
2017-09-06 14:25   ` Jun T.

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20455.1504700763@thecus.kiddle.eu \
    --to=okiddle@yahoo.co.uk \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).