Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: zsh.texi



Bart Schaefer wrote:
> I'm just glancing at the programmable completion section at the moment.
> Some of it is still pretty hard to decipher.  Here's an example:
> 
> 
> -d This can be combined with -F, -B, -w, -a, -R and -G to get names of
>        disabled functions, builtins, reserved words or aliases. 
> -e Without -d this option has no effect. Otherwise this can be combined
>        with -F, -B, -w, -a, -R and -G to get names of functions, builtins,
>        reserved words or aliases even if they are disabled. 
> 
> 
> That stuff under -e doesn't make sense to me -- Without -d, has no effect?
> You mean I have to use `compctl -d -e ...'?  Why? -- and it conflicts with
> the zshcompctl.man description:
> 
> -e Names of executable (and enabled) commands.

Sorry for the late response but I was away in the last few days.  Actually
in beta20 I corrected the documentation of compctl -e and compctl -d, and I
also changed its behaviout a little bit.  If you try compctl -e and compctl
-d in any zsh version you'll see that it does not behave as it is
documented.  In beta20 it behaved as described above.  -e or -d only have
effect if combined with -F, -B, -w, -a, -R or -G.  But these flags by
default only complete enabled commands, so compctl -e has no effect
(because it is assumed as default).  This means that -e is only necessary
if you'd like to complete both enabled and disabled commands when you use
-ed.  This may seem to be illogical.  The logical solution is to list
enabled commands by default, but with -d, list only disabled ones and with
an other flag list all of them but this would be incompatible with the old
versions (but since -e and -d was not documented correctly this may not be
a big problem).

Before beta20 the above options listed all builtins/aliases/functions even
if they were disabled.  Before beta20 there were no commands to complete
external commands or reserved words.  These new flags were added in beta20.

There are some problems with compctl -L output in beta20 which I've already
fixed (but I did not send patch, it'll be in beta21).  The maual still
needs some corrections.  The description of -, command, noglob and exec
prefixes should probably be moved into zshbuiltins.man because these are
builtins now.  But the present location may be better for these so it may
be better to keep them there noting that these are builtins, remove these
from the reserved word list and add to zshbuiltins.man with pointers to the
documentation in zshmisc(1).

There will be some other changes in beta21 which require changes in the
maual.  I rewrote redirection handling to conform POSIX.  In beta21 in a
>& $foo redirection $foo will be expanded first, and if the result is a
number, - or p, that filenumber is duplicated, a file is closed or the
output is written to the coprocess.  Otherwise >& redirects both stdout and
stderr.  The &>, &>|, &>> etc. syntax can be used for redirecting both
stdout and stderr when the filename is a number or - or p.  This was taken
from bash.

I'd like to implement <> redirection as well which is often quite useful
and it is required by POSIX as well.  When not in sh/ksh mode <> will only
be recocnized as a redirection if it is delimited from the word before and
after it or if it is immediately preceeded by a digit.  E.g.
% foo arguments 2<> bar      # redirection
% foo arguments2<>  bar      # numeric glob
% foo arguments 22<> bar     # numeric glob
% foo arguments <>bar        # numeric glob
% foo arguments <> bar       # redirection
% foo arguments <-> bar      # numeric glob

In sh/ksh mode <> will always be interpreted as a redirection and <-> will
be required to match an arbitrary number.

Zoltan




Messages sorted by: Reverse Date, Date, Thread, Author