zsh-workers
 help / color / mirror / code / Atom feed
From: dana <dana@dana.is>
To: Daniel Shahaf <d.s@daniel.shahaf.name>
Cc: Aurélien <orel_jf@yahoo.fr>, "Zsh hackers list" <zsh-workers@zsh.org>
Subject: Re: help for writing GNU stow completion
Date: Sat, 17 Aug 2019 16:44:22 -0500	[thread overview]
Message-ID: <C26AD56E-AE88-42A9-832B-46AD2AA76A75@dana.is> (raw)
In-Reply-To: <0618d7fc-5334-4e51-829a-8684a81744c1@www.fastmail.com>

On 17 Aug 2019, at 12:53, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> Sorry, but I have to object to the PR as it stands.  As I said, using
> «eval $1» causes expressions on the command line to be evaluated
> _when completion is attempted_.  To me, that breaks the principle of
> least surprise, and could lead to unexpected and undesired results.
>
> I would strongly prefer another solution, or to be corrected on my
> interpretation that this violates least surprise.

Oh, i didn't notice that the GitHub thing was a PR for zsh.

I agree with this. And i can't think of a general-purpose alternative that's
currently built into the shell.

Apparently i made the same mistake when i wrote _composer, though; attached
replaces the eval by (as i mentioned) what seems to be the prevailing
convention. I think a similar change might be warranted in _git @ 2866?

dana


diff --git a/Completion/Unix/Command/_composer b/Completion/Unix/Command/_composer
index 2b9f2cd32..191350453 100644
--- a/Completion/Unix/Command/_composer
+++ b/Completion/Unix/Command/_composer
@@ -115,7 +115,7 @@ __composer_prune_global_opts() {
 (( $+functions[__composer_update_work_dir] )) ||
 __composer_update_work_dir() {
   if [[ -n ${(v)opt_args[(i)(-d|--working-dir)]} ]]; then
-    eval _composer_work_dir=${(v)opt_args[(i)(-d|--working-dir)]}
+    _composer_work_dir=${(Q)${(v)opt_args[(i)(-d|--working-dir)]}}
   elif [[ -z $_composer_work_dir ]]; then
     _composer_work_dir=$PWD
   fi


  reply	other threads:[~2019-08-18 12:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1e5195bb-3126-8d0c-8a6a-1f5a5fd2a6c0@yahoo.fr>
     [not found] ` <BAE67462-BF39-481A-BCD6-DE288FE6CC92@dana.is>
     [not found]   ` <d30637f3-cbbb-8b93-35f2-421a1a99e1dc@yahoo.fr>
2019-08-17 17:53     ` Daniel Shahaf
2019-08-17 21:44       ` dana [this message]
2019-08-20 17:45       ` Aurélien
2019-08-25  1:14         ` dana
2019-10-13 17:51           ` Aurélien
2019-10-16  1:14             ` dana

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=C26AD56E-AE88-42A9-832B-46AD2AA76A75@dana.is \
    --to=dana@dana.is \
    --cc=d.s@daniel.shahaf.name \
    --cc=orel_jf@yahoo.fr \
    --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).