* Re: "[[" (Re: PATCH: _urls again (Re: setopt localoptions noautoremoveslash))
@ 1999-10-18 6:59 Sven Wischnowsky
0 siblings, 0 replies; 2+ messages in thread
From: Sven Wischnowsky @ 1999-10-18 6:59 UTC (permalink / raw)
To: zsh-workers
Bart Schaefer wrote:
> PWS says in http://www.ifh.de/~pws/computing/zshguide02.html#l6
>
> Second aside for users of sh: you may remember that tests in sh used
> a single pair of brackets, `if [ ... ]; then ...', or equivalently
> as a command called test, `if test ...; then ...'. The Korn shell
> was deliberately made to be different, and zsh follows that. The
> reason is that `[[' is treated specially, which allows the shell to
> do some extra checks and allows more natural syntax.
Here on zsh-workers we could probably say what the real difference is:
the parser knows about `[[ .. ]]' which should allow for faster
execution (I guess this is what Peter meant by `treated specially').
`[ .. ]' can only be handled as a normal builtin.
Bye
Sven
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: PATCH: _urls again (Re: setopt localoptions noautoremoveslash)
@ 1999-10-15 12:10 Sven Wischnowsky
1999-10-15 15:30 ` Oliver Kiddle
0 siblings, 1 reply; 2+ messages in thread
From: Sven Wischnowsky @ 1999-10-15 12:10 UTC (permalink / raw)
To: zsh-workers
Oliver Kiddle wrote:
> One strange behaviour I find with completing urls is that with
> urls_localhttpd set, when I complete user directories, menu
> selection is entered imediately rather than waiting for a second tab:
> e.g: netscape http://risc10/~<tab> will insert 'ada' and give me the
> list with 'ada' selected rather than just giving me the list. This
> behaviour continues when completing files and directories after the
> username.
>
> I've also noticed that with this dual file/directory completion and
> description_format set, I get 'file' aswell as 'directory' at the top
> of the list even if there were no files to complete.
Do you mean to say that you still get this or that you fixed it? At
least I don't get either of these after your patch. If you still get
them, I need more information about your configuration and the
possible matches that triggered it.
Bye
Sven
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: PATCH: _urls again (Re: setopt localoptions noautoremoveslash)
1999-10-15 12:10 PATCH: _urls again (Re: setopt localoptions noautoremoveslash) Sven Wischnowsky
@ 1999-10-15 15:30 ` Oliver Kiddle
1999-10-16 13:56 ` Tanaka Akira
0 siblings, 1 reply; 2+ messages in thread
From: Oliver Kiddle @ 1999-10-15 15:30 UTC (permalink / raw)
To: zsh-workers
Sven Wischnowsky wrote:
> Do you mean to say that you still get this or that you fixed it? At
> least I don't get either of these after your patch. If you still get
> them, I need more information about your configuration and the
> possible matches that triggered it.
I mean that I still get this.
I tracked down the first problem to setopt glob_complete. i.e, the
following is sufficient to cause the problem:
zsh -f
ZLS_COLOURS=...;SELECTMIN=0;zmodload complist
autoload -U compinit;compinit -d
compconf urls_localhttp=...
setopt globcomplete
In the process, I established that _urls requires globcomplete; patch
follows.
With respect to the second problem, I think I was just confused by the
fact that I got a listing which looks like:
file
directory
fred/ joe
when I expected the file to appear before 'directory' so sorry for not
checking it before I sent the mail.
Tanaka Akira wrote:
> +++ Completion/User/_urls 1999/10/15 14:28:55
> @@ -1,4 +1,4 @@
> -#autoload
> +#compdef curl
Shouldn't this be done in _webbrowser. Or we should do what I suggested
before which is to ditch _webbrowser, add the programs to a compdef in
_urls and negate the meaning of -f to _urls.
> * Use [[ ... ]] instead of [ ... ].
Could someone please explain why [[ ... ]] seems to be prefered where
both forms provide the same functionality ? Sven also changed my use of
[ -d ... ] to use the double square brackets. Is it faster or something?
Oliver Kiddle
--- _urls.bak3 Fri Oct 15 16:11:03 1999
+++ _urls Fri Oct 15 16:13:26 1999
@@ -37,6 +37,8 @@
# name used by a user placing web pages within their home area.
# e.g. compconf
urls_localhttp=www:/usr/local/apache/htdocs:public_html
+setopt localoptions extendedglob
+
local ipre scheme host user dirs files ret=1 expl
local localhttp_servername="${${(@s.:.)compconfig[urls_localhttp]}[1]}"
local
localhttp_documentroot="${${(@s.:.)compconfig[urls_localhttp]}[2]}"
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: PATCH: _urls again (Re: setopt localoptions noautoremoveslash)
1999-10-15 15:30 ` Oliver Kiddle
@ 1999-10-16 13:56 ` Tanaka Akira
1999-10-16 15:33 ` "[[" (Re: PATCH: _urls again (Re: setopt localoptions noautoremoveslash)) Bart Schaefer
0 siblings, 1 reply; 2+ messages in thread
From: Tanaka Akira @ 1999-10-16 13:56 UTC (permalink / raw)
To: zsh-workers
In article <38074889.6DCA13F@u.genie.co.uk>,
Oliver Kiddle <opk@u.genie.co.uk> writes:
> > -#autoload
> > +#compdef curl
>
> Shouldn't this be done in _webbrowser. Or we should do what I suggested
> before which is to ditch _webbrowser, add the programs to a compdef in
> _urls and negate the meaning of -f to _urls.
I don't think so. The name of the function should show its (default)
behaviour. If _urls complete files by default, it should be renamed
to _filesurls or some similar name.
>
> > * Use [[ ... ]] instead of [ ... ].
>
> Could someone please explain why [[ ... ]] seems to be prefered where
> both forms provide the same functionality ? Sven also changed my use of
> [ -d ... ] to use the double square brackets. Is it faster or something?
I'm not sure about this. But I believe the description of `test' in
zshbuiltins(1).
--
Tanaka Akira
^ permalink raw reply [flat|nested] 2+ messages in thread
* "[[" (Re: PATCH: _urls again (Re: setopt localoptions noautoremoveslash))
1999-10-16 13:56 ` Tanaka Akira
@ 1999-10-16 15:33 ` Bart Schaefer
0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 1999-10-16 15:33 UTC (permalink / raw)
To: zsh-workers
On Oct 16, 10:56pm, Tanaka Akira wrote:
} Subject: Re: PATCH: _urls again (Re: setopt localoptions noautoremoveslash
}
} In article <38074889.6DCA13F@u.genie.co.uk>,
} Oliver Kiddle <opk@u.genie.co.uk> writes:
} >
} > > * Use [[ ... ]] instead of [ ... ].
} >
} > Could someone please explain why [[ ... ]] seems to be prefered where
} > both forms provide the same functionality ? Sven also changed my use of
} > [ -d ... ] to use the double square brackets. Is it faster or something?
}
} I'm not sure about this. But I believe the description of `test' in
} zshbuiltins(1).
PWS says in http://www.ifh.de/~pws/computing/zshguide02.html#l6
Second aside for users of sh: you may remember that tests in sh used
a single pair of brackets, `if [ ... ]; then ...', or equivalently
as a command called test, `if test ...; then ...'. The Korn shell
was deliberately made to be different, and zsh follows that. The
reason is that `[[' is treated specially, which allows the shell to
do some extra checks and allows more natural syntax. For example,
you may know that in sh it's dangerous to test a parameter which
may be empty: `[ $var = foo ]' will fail if $var is empty, because
the word is missed out and the shell never knows it was supposed
to be there (I'll explain about parameters shortly); with `[[ ...
]]', this is quite safe because the shell is aware there's a word
before the `=', even if it's empty. Also, you can use `&&' and
`||' to mean logical `and' and `or', which agrees with the usual
UNIX/C convention; in sh, they would have been taken as starting a
new command, not as part of the test, and you have to use the less
clear `-a' and `-o'. Actually, zsh provides the old form of test for
backward compatibility, but things will work a lot more smoothly if
you don't use it.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1999-10-18 6:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-10-18 6:59 "[[" (Re: PATCH: _urls again (Re: setopt localoptions noautoremoveslash)) Sven Wischnowsky
-- strict thread matches above, loose matches on Subject: below --
1999-10-15 12:10 PATCH: _urls again (Re: setopt localoptions noautoremoveslash) Sven Wischnowsky
1999-10-15 15:30 ` Oliver Kiddle
1999-10-16 13:56 ` Tanaka Akira
1999-10-16 15:33 ` "[[" (Re: PATCH: _urls again (Re: setopt localoptions noautoremoveslash)) Bart Schaefer
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).