zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Subject: Re: [PATCH] edit-command-line breaks arguments with spaces
Date: Sat, 14 Oct 2017 13:57:32 +0000	[thread overview]
Message-ID: <1507989452.1856983.1138671752.5772DAF0@webmail.messagingengine.com> (raw)
In-Reply-To: <20171014042152.GA96140@tower.spodhuis.org>

Phil Pennock wrote on Sat, 14 Oct 2017 00:21 -0400:
> 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.

Good point; changing «${(Q)foo}» to «"${(@Q)foo}"» and «$editor» to «"${editor[@]}"»
would also work: the problem wasn't (Q) per se, but the lack of (@).

Between eval and (@Q) I think I'm leaning towards the latter.

Thanks Phil.

Cheers,

Daniel


  reply	other threads:[~2017-10-14 13:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-13 23:05 Marco Hinz
2017-10-14  0:07 ` Daniel Shahaf
2017-10-14  0:45   ` Marco Hinz
2017-10-14  0:55   ` Bart Schaefer
2017-10-14  1:52     ` Daniel Shahaf
2017-10-14  4:21       ` Phil Pennock
2017-10-14 13:57         ` Daniel Shahaf [this message]
2017-10-14  1:56     ` Daniel Shahaf
2017-10-14 18:40     ` Marco Hinz
2017-10-15  1:35       ` Bart Schaefer
2017-10-15 14:15         ` Marco Hinz

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=1507989452.1856983.1138671752.5772DAF0@webmail.messagingengine.com \
    --to=d.s@daniel.shahaf.name \
    --cc=zsh-workers@zsh.org \
    /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).