* Re: PATCH: mysql completions
@ 2000-03-13 10:29 Sven Wischnowsky
2000-07-31 22:14 ` missing -o kshautoload checks Adam Spiers
0 siblings, 1 reply; 3+ messages in thread
From: Sven Wischnowsky @ 2000-03-13 10:29 UTC (permalink / raw)
To: zsh-workers
Adam Spiers wrote:
> This turned out to be a really good way of getting my head round
> recent changes to the completion system. Comments on the style (and
> correctness, especially relating to tags) welcome ...
The tags stuff looks fine, as far as I can see.
> ...
>
> +_mysql_databases () {
> + local _mysql_user _mysql_port _mysql_host _mysql_params
> + _mysql_get_identity
> +
> + local _mysql_databases
> + _mysql_databases=(
> + ${(f)~~"$( echo "show databases" |
> + mysql "$_mysql_params[@]" )"}
> + )
> + shift _mysql_databases
> +
> + compadd "$expl[@]" - $_mysql_databases
> +}
This works, because $expl is set in all callers, but I think it would
be nicer to make this explicit by using $@. _argument gives $expl as
the arguments anyway (the way _mysql_databases is called from it) and
for the call from _*_commands it could easily be added. Maybe that's
just personal taste.
> +_mysql_tables () {
> + local _mysql_user _mysql_port _mysql_host _mysql_params
> + _mysql_get_identity
> +
> + local _mysql_tables
> + _mysql_tables=(
> + ${(f)~~"$( echo "show tables" |
> + mysql "$_mysql_params[@]" $1 )"}
> + )
> + # remove header
> + shift _mysql_tables
> +
> + compadd "$expl[@]" - $_mysql_tables
> +}
Almost the same, I think it would be better to change the calls to use
`{ _mysql_tables $line[1] $expl }'.
> ...
>
> +_mysql_utils "$@"
[[ -o kshautoload ]] || _mysql_utils "$@"
(I hate kshautoload, too ;-)
Bye
Sven
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 3+ messages in thread
* missing -o kshautoload checks
2000-03-13 10:29 PATCH: mysql completions Sven Wischnowsky
@ 2000-07-31 22:14 ` Adam Spiers
2000-08-01 7:12 ` Bart Schaefer
0 siblings, 1 reply; 3+ messages in thread
From: Adam Spiers @ 2000-07-31 22:14 UTC (permalink / raw)
To: zsh-workers
A while ago, Sven Wischnowsky (wischnow@informatik.hu-berlin.de) wrote:
> [[ -o kshautoload ]] || _mysql_utils "$@"
>
> (I hate kshautoload, too ;-)
A recursive grep for '_[a-z_]* "$@"' in the Completion directory
reveals that there are quite a few of these [[ -o kshautoload ]]
checks missing. I'm a bit short on time right now; any kind soul care
to add them in?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: missing -o kshautoload checks
2000-07-31 22:14 ` missing -o kshautoload checks Adam Spiers
@ 2000-08-01 7:12 ` Bart Schaefer
0 siblings, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 2000-08-01 7:12 UTC (permalink / raw)
To: Adam Spiers, zsh-workers
On Jul 31, 11:14pm, Adam Spiers wrote:
}
} A recursive grep for '_[a-z_]* "$@"' in the Completion directory
} reveals that there are quite a few of these [[ -o kshautoload ]]
} checks missing. I'm a bit short on time right now; any kind soul care
} to add them in?
I think there was at least a semi-conscious decision to stop including
those lines. Chapter "Completion System" section "Initialization" heading
"Autoloaded files" explains:
Note also that the functions for the completion system assume that the
KSH_AUTOLOAD option is not set and cannot be loaded when it is set. To
avoid having to unset KSH_AUTOLOAD, you can instead use one or more zwc
file which have been created with the command zcompile -z to load
the functions for the completion system; see *Note Shell Builtin
Commands::. This forces the functions to be autoloaded the way zsh
normally loads functions.
I haven't actually tried it, but I'm pretty sure that if you `zcompile -z'
a file that ends with `[[ -o kshautoload ]] && $0 "$@"', and you have
kshautoload set, you'll end up executing the function *twice* the first
time it's autoloaded. So really we should be *removing* all the checks
for kshautoload, not adding more of them.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2000-08-01 7:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-03-13 10:29 PATCH: mysql completions Sven Wischnowsky
2000-07-31 22:14 ` missing -o kshautoload checks Adam Spiers
2000-08-01 7:12 ` 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).