From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18499 invoked by alias); 14 Oct 2017 04:39:46 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 41887 Received: (qmail 4731 invoked by uid 1010); 14 Oct 2017 04:39:45 -0000 X-Qmail-Scanner-Diagnostics: from mx.spodhuis.org by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(94.142.241.89):SA:0(-4.2/5.0):. Processed in 2.682583 secs); 14 Oct 2017 04:39:45 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: zsh-workers+phil.pennock@spodhuis.org X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=spodhuis.org; s=d201708; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=OR39d8ptXtvwe7Zf7YsOH6Rcs1BqQz6qG5LVWCQGAsg=; b=Kva8Ib1ycu3OYHjEEOGPbUGiSy 7f2p8/XHE8CFhbPgBo8eQxKCFzasLsM+QhWuOvngU0r+ouRe6JjUG577Pmy36KldR+0bkCV0TiYaI E5dyLrgz1X7BddvwOa15+cxZvngAoXp3bFNL0eQWOjO8HNIL3rQsIo2HtC/nDKWeoEVVkNkMX9EQd r8lzNN5v4pMzyqUrObzRb9Mjw3qu; Date: Sat, 14 Oct 2017 00:21:53 -0400 From: Phil Pennock To: Daniel Shahaf Cc: zsh-workers@zsh.org Subject: Re: [PATCH] edit-command-line breaks arguments with spaces Message-ID: <20171014042152.GA96140@tower.spodhuis.org> References: <4B40504C-14CC-4EE0-8A53-5CF67C67E37E@gmail.com> <1507939677.3717869.1138301848.03470D9F@webmail.messagingengine.com> <171013175555.ZM12982@torch.brasslantern.com> <1507945924.3744661.1138358040.4B6A109D@webmail.messagingengine.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1507945924.3744661.1138358040.4B6A109D@webmail.messagingengine.com> OpenPGP: url=https://www.security.spodhuis.org/PGP/keys/0x4D1E900E14C1CC04.asc On 2017-10-14 at 01:52 +0000, Daniel Shahaf wrote: > If $EDITOR is set to "vim -c ''", then: > > - current master passes «''» (two characters) for vim's argv[2] > > - using eval passes the empty string for vim's argv[2] > > - using ${(Q)} elides the "" entirely No, the (Q) has nothing to do with it. The problem is that in zsh, expanding an unquoted array variable omits empty elements. So instead of «$editor» it needs to be «"${editor[@]}"» or «"${(@)editor}"» to keep the empty elements present at _expansion_ time. This is the same reason that even in zsh, in normal zsh mode of not splitting on whitespace, when passing through remaining elements of argv unmolested you still have to use «"$@"» instead of just «$@». % FOO="vim -C ''" % foo=("${(Q@)${(z)FOO}}") % print $#foo 3 % print -l $foo vim -C % print -l .$foo .vim .-C . % print -l "${(@)foo}" vim -C % -Phil