zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@sunsite.dk
Cc: 243385@bugs.debian.org
Subject: Re: [ejb@ql.org: Bug#243385: zsh: rsync completion expands * too soon]
Date: Tue, 13 Apr 2004 17:44:53 +0000	[thread overview]
Message-ID: <1040413174453.ZM21002@candle.brasslantern.com> (raw)
In-Reply-To: <200404131617.i3DGHX7s031305@soup.acv.apexcovantage.com>

[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@ql.org: 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.


  reply	other threads:[~2004-04-13 17:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-13  1:21 Clint Adams
2004-04-13  1:37 ` Jay Berkenbilt
2004-04-13  2:19   ` Clint Adams
2004-04-13 16:17     ` Jay Berkenbilt
2004-04-13 17:44       ` Bart Schaefer [this message]
2004-04-13 22:55         ` Clint Adams
2004-04-14 16:37           ` more boring zsh-in-Arch chatter [was Re: [ejb@ql.org: Bug#243385: zsh: rsync completion expands * too soon]] Clint Adams
2004-04-25  2:07             ` more boring zsh-in-Arch chatter Clint Adams

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=1040413174453.ZM21002@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=243385@bugs.debian.org \
    --cc=zsh-workers@sunsite.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).