zsh-users
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: zsh-users@sunsite.dk (Zsh users list)
Subject: Re: java class names completion widget
Date: Thu, 15 Jun 2006 17:19:10 +0100	[thread overview]
Message-ID: <200606151619.k5FGJBFb022067@news01.csr.com> (raw)
In-Reply-To: <200606151938.36646.kos@supportwizard.com>

Konstantin Sobolev wrote:
> It works, but how can I force it to use menu completion instead of cycling? 
> Playing with 
> zstyle ':completion:*' menu select
> gives a bit weird effect:
> (with descriptions turned on)

I was hoping you weren't going to ask that...

I think a change of tack is the easiest way.  Instead of hacking the
_expand completer, which has some odd settings, the following goes
through the normal completer; the trick with _generic is to allow us
to use a widget bound to a key but still use the normal completion
logic.  Then we simply do the expansion by hand and add the results
unconditionally, i.e. without additional matching (compadd -U).  This
may have side effects but it seems basically OK.

_expand_java_path now contains:

  #autoload
  local MATCH MBEGIN MEND pref suf

  pref="**/${PREFIX//(#m)[[:upper:]]/${MATCH}[^[:upper:]]#}"
  suf="${SUFFIX//(#m)[[:upper:]]/${MATCH}[^[:upper:]]#}*.java"

  local expl
  local -a exp
  exp=(${~pref}${~suf}(N))
  if (( ${#exp} )); then
    _wanted java-files expl 'java source file (search)' \
      compadd -U -a exp
  else
    return 1
  fi

and .zshrc now requires the following setup:

  zle -C expand-java-path complete-word _generic
  zstyle ':completion:expand-java-path:*' completer _expand_java_path
  bindkey '^xj' expand-java-path

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php


  reply	other threads:[~2006-06-15 16:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-05 18:40 Konstantin Sobolev
2006-06-07 10:47 ` Peter Stephenson
2006-06-15 15:38   ` Konstantin Sobolev
2006-06-15 16:19     ` Peter Stephenson [this message]
2006-06-15 18:41       ` Konstantin Sobolev

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=200606151619.k5FGJBFb022067@news01.csr.com \
    --to=pws@csr.com \
    --cc=zsh-users@sunsite.dk \
    /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).