zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers@zsh.org
Subject: Re: _multi_parts and -q
Date: Sat, 18 Jun 2011 20:52:18 +0100	[thread overview]
Message-ID: <20110618205218.093eb2f8@pws-pc.ntlworld.com> (raw)
In-Reply-To: <20110617215008.GA3154@lorien.comfychair.org>

On Fri, 17 Jun 2011 14:50:08 -0700
Danek Duvall <duvall@comfychair.org> wrote:
> I was hoping that this
> 
>     _wanted dataset expl "$expl_type" _multi_parts "$@" -q / datasetlist
> 
> would add slashes as auto-removable suffixes, but it doesn't appear to.
> That is, if I type a slash immediately after a slash, it gets swallowed,
> but the slash doesn't disappear after hitting space or return.  Is this an
> issue with _multi_parts, or something I'm doing wrong?  I tried putting in
> -S/ explicitly, but that didn't seem to make a difference.

_multi_parts is completely impenetrable, with no fewer than *18* calls
to compadd, but there is some evidence it is handling the -q and -S
options (the zparseopts at the start) and using the resulting $sopts in
some places, which is what the documentation says it does, although
reading the documentation didn't entirely fill me with confidence that I
understood everything that was going on. 

Anyway I think the following is working as I expect:

  _wanted dataset expl "$expl_type" _multi_parts -S/ -q / datasetlist;  

in that:

- if I complete something ambiguous I don't get the suffix
- if I complete something unambiguous I do
- the suffix is removable with the usual features:
-- it's highlighted if you're using Mikael's autoremove highlighting
   feature
-- if I type a "/" it replaces the autoremovable "/"
-- if I type a " " the "/" goes and the " " stays
-- if I type a letter the "/" stays and the letter appears immediately
   after.

That's pretty much all I'm expecting.

Note that I use menu completion, which shouldn't make a difference at
this level but might do.

I was testing with this entirely spurious function:

_tst() {
  local expl_type="stuff"
  local -a datasetlist
  datasetlist=(foo bar rod stuff)
  local pref
  [[ $PREFIX = */* ]] && pref=${PREFIX%/*} 
  [[ -n $pref ]] && datasetlist=($pref/${^datasetlist})
  _wanted dataset expl "$expl_type" _multi_parts -S/ -q / datasetlist;
}                     

simply to get strings to compile.  I don't think that should matter.

-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


  parent reply	other threads:[~2011-06-18 19:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-17 21:50 Danek Duvall
2011-06-18 19:44 ` Bart Schaefer
2011-06-18 19:52 ` Peter Stephenson [this message]
2011-06-18 20:03   ` Bart Schaefer
2011-06-18 21:07     ` Peter Stephenson
2011-06-20 15:44       ` Danek Duvall
2011-06-21  5:03       ` Bart Schaefer
2011-06-21  5:40         ` Danek Duvall
2011-06-21  8:02           ` Bart Schaefer

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=20110618205218.093eb2f8@pws-pc.ntlworld.com \
    --to=p.w.stephenson@ntlworld.com \
    --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).