Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [ejb@xxxxxx: Bug#243385: zsh: rsync completion expands * too soon]
- X-seq: zsh-workers 19771
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: [ejb@xxxxxx: Bug#243385: zsh: rsync completion expands * too soon]
- Date: Tue, 13 Apr 2004 17:44:53 +0000
- Cc: 243385@xxxxxxxxxxxxxxx
- In-reply-to: <200404131617.i3DGHX7s031305@xxxxxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20040413012117.GA9729@xxxxxxxxxxx> <200404130137.i3D1b5CW004764@xxxxxxxxxxxxxx> <20040413021931.GA10355@xxxxxxxxxxx> <200404131617.i3DGHX7s031305@xxxxxxxxxxxxxxxxxxxxxxxxxx>
[I don't know whether ejb will see this, because I don't know if he's
subscribed to zsh-uses and I suspect bugs.debian.org is going to reject
my mail because I'm on a DSL line. We'll see ...]
On Apr 13, 12:17pm, Jay Berkenbilt wrote:
} Subject: Re: [ejb@xxxxxx: Bug#243385: zsh: rsync completion expands * too
}
} To me, something feels cleaner and safer about avoiding the
} unnecessary eval than enclosing everything in an extra set of quotes
If the eval were unnecessary, believe me, it wouldn't be there.
} This will probably break if _call_program is changed to do what it
} does differently.
It's extremely unlikely that _call_program could be made to do what it
does without the eval.
} On the other hand, since I'll admit to not completely understanding
} what the purpose of _call_program is (it looks to me like it provides
} a mechanism for using zstyle to tell zsh that command names should be
} completed at a given point in expanding a program's argument)
No, that's not what it's for at all.
In this particular case, It's so that you can use a zstyle to tell the
completion function that it should use something other than ssh as the
remote shell program for expanding the file names. It implements the
"command" zstyle, which is documented:
command
In many places, completion functions need to call external
commands to generate the list of completions. This style can be
used to override the command that is called in some such cases.
The elements of the value are joined with spaces to form a command
line to execute. The value can also start with a hyphen, in which
case the usual command will be added to the end; this is most
useful for putting `builtin' or `command' in front to make sure
the appropriate version of a command is called, for example to
avoid calling a shell function with the same name as an external
command.
So, if for example I have a shell function named "ssh", I might do
zstyle ':completion:*:complete:scp:*:files' command command -
which would cause _call_program to eval "command ssh ..." when _ssh asks
for remote file completions, and thereby bypass my shell function.
} Note that _ssh and _rlogin both have remote_files functions that do
} not call _call_program.
In the case of _rlogin, it *should* be using _call_program, but that
function predates the invention of the "command" style and has not yet
been updated. Thanks for pointing that out.
} _ssh used to before my previous patch but now doesn't.
Your previous patch was not applied to the "official" zsh sources (I
don't know about the Debian repackaging). Instead a patch that added
quoting was done, very similar to what Clint posted for _rsync. (The
-L option *did* get added to the "ls" in _ssh.) So _ssh *does* have
_call_program.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author