zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: Zsh workers <zsh-workers@sunsite.auc.dk>
Subject: Re: help with _match, globcomplete etc. (with a PATCH)
Date: Wed, 16 Feb 2000 11:52:06 +0000	[thread overview]
Message-ID: <1000216115206.ZM26052@candle.brasslantern.com> (raw)
In-Reply-To: <38AA7E36.135EBD1E@u.genie.co.uk>

On Feb 16, 10:38am, Oliver Kiddle wrote:
} Subject: Re: help with _match, globcomplete etc. (with a PATCH)
}
} The reason I wanted this is basically that I use a number of associative
} arrays to point to different areas of the system I work on. [...]
} 
} [...] This leads me to make a suggestion which may or may not be easy
} but would solve my problems: in the same way as a variable whose
} value is a directory can be refered to with ~, could the same be made
} to work for associative arrays (and arrays in general I suppose),
} allowing me to use stuff like ~code[ai] and ~test[$area]?

Hrm.  You can already manually stuff things into the nameddir hash:

zagzig% unsetopt glob
zagzig% typeset -A xx 
zagzig% xx=($(print -l $path | cat -n))
zagzig% echo $xx[9]
/usr/etc
zagzig% for x in ${(k)xx}; hash -d xx[$x]=$xx[$x]
zagzig% cd ~xx[9]<TAB>
zagzig% cd ~xx[9]/

Well, would you look at that.  But if there I press return, I get:

cd: no such file or directory: ~xx[9]

That's because the [ and ] are tokenized most of the time, so they don't
match what has been added to the hash even if the typtab is modified to
treat them as IUSER.  It's probably an accident that the trailing slash
gets added that first time; you can't complete any further after it.

So it may be possible to make this work by using a more sophisticated
parse than simply scanning past all the IUSER characters, and then
throwing in a few calls to untokenize(); but I don't think I'm going to
attempt it.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


  reply	other threads:[~2000-02-16 11:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-02-15 16:08 help with _match, globcomplete etc Sven Wischnowsky
2000-02-15 19:53 ` help with _match, globcomplete etc. (with a PATCH) Oliver Kiddle
2000-02-16  6:47   ` Bart Schaefer
2000-02-16 10:38     ` Oliver Kiddle
2000-02-16 11:52       ` Bart Schaefer [this message]
2000-02-16 10:11 Sven Wischnowsky
2000-02-16 10:57 ` Bart Schaefer
2000-02-16 11:18 ` Oliver Kiddle
2000-02-16 15:39 Sven Wischnowsky
2000-02-17 14:43 Sven Wischnowsky

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=1000216115206.ZM26052@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=zsh-workers@sunsite.auc.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).