From: "E. Jay Berkenbilt" <ejb@ql.org>
To: schaefer@candle.brasslantern.com
Cc: zsh-users@sunsite.auc.dk
Subject: Re: completion with globbing, take 2
Date: Mon, 18 Sep 2000 18:07:40 -0400 [thread overview]
Message-ID: <200009182207.SAA06782@soup.ads.apexinc.com> (raw)
In-Reply-To: <1000918172840.ZM29857@candle.brasslantern.com> (schaefer@candle.brasslantern.com)
> } Also, after reading the code, I don't believe it is true that _match
> } won't do anything without matcher-list set -- see analysis and
> } questions below.
>
> Right, I was confused, as Andrej has already pointed out. (The completion
> system has a tendency to do that to almost anyone from time to time, even
> Sven.)
Actually, I'll admit to being heartened to see others getting confused
about this. It is pretty confusing. :-)
> On Sep 17, 8:17pm, E. Jay Berkenbilt wrote:
> } Subject: completion and globbing, part 2
> }
> } It occurred to me that if the analysis in my last message was true,
> } the following would work:
> [...]
> } This does, in fact, give me exactly the behavior I'm looking for
> } without using _expand or _match.
>
> Does it? What happens when you complete a pattern that matches only
> directories? (I get, it inserts all the directories and adds a slash
> after only the last one, so if I press TAB again I get completions in
> that last directory, which seems unlikely to be what you'd want.)
Well, in fact, I never do this with rmdir. I chose it as an example
only because it's easy to work with and has simple completion
functions. I really use this with cvs add and cvs rm where it is
great. If I create a bunch of test files, I can do cvs add *TAB and
automatically not get the files that are already registered or files
that are in .cvsignore. A great timesaver. What I used to do is
cvs add `cvs -qn update | fgrep '?' | awk '{print $2}'` (or something
like that) which isn't tooo bad but is obviously not as nice as cvs
add *TAB. :-)
> Incidentally, the three lines
>
> ret=1
> _complete && ret=0
> return ret
>
> are equivalent to just
>
> _complete
> return
>
> and if _complete is the last line in the function, you don't even need
> the `return'.
Nice to know. So I guess zsh functions are like lisp and perl -- the
value of the last statement is the return value -- but with the
additional feature that return with no arguments returns the last
value.... I'll have to play a bit to see what the real rules are or
check the documentation. Over time as I gain more experience in more
languages and work with more people's code, I find myself
philosophically leaning more toward the Python mentality of making
everything explicit, but that's another topic for another forum....
--
E. Jay Berkenbilt (ejb@ql.org) | http://www.ql.org/q/
next prev parent reply other threads:[~2000-09-18 22:08 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-09-17 17:50 E. Jay Berkenbilt
2000-09-17 18:43 ` Bart Schaefer
2000-09-17 23:03 ` E. Jay Berkenbilt
2000-09-18 0:17 ` completion and globbing, part 2 E. Jay Berkenbilt
2000-09-18 6:53 ` Andrej Borsenkow
2000-09-18 9:59 ` insert-all-matches example " Andrej Borsenkow
2000-09-18 17:28 ` completion with globbing, take 2 Bart Schaefer
2000-09-18 18:08 ` Andrej Borsenkow
2000-09-19 2:02 ` Bart Schaefer
2000-09-20 15:06 ` Andrej Borsenkow
2000-09-20 16:12 ` Bart Schaefer
2000-09-18 22:07 ` E. Jay Berkenbilt [this message]
2000-09-19 2:14 ` Bart Schaefer
2001-02-20 9:55 ` Job Table Nick Cross
2000-09-18 6:07 ` completion with globbing, take 2 Andrej Borsenkow
2000-10-04 11:14 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=200009182207.SAA06782@soup.ads.apexinc.com \
--to=ejb@ql.org \
--cc=schaefer@candle.brasslantern.com \
--cc=zsh-users@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).