zsh-workers
 help / color / mirror / code / Atom feed
From: dana <dana@dana.is>
To: Oliver Kiddle <okiddle@yahoo.co.uk>
Cc: zsh-workers@zsh.org
Subject: Re: [PATCH] Completion batch #2: Misc. trivial fixes
Date: Sat, 6 Jan 2018 00:11:38 -0600	[thread overview]
Message-ID: <909F11B4-7936-47FD-9A2B-F339BD73125F@dana.is> (raw)
In-Reply-To: <0D626F37-219D-49BC-A1CA-31A8F1CABF1E@dana.is>

On 3 Jan 2018, at 18:03, dana <dana@dana.is> wrote:
>The way i had handled this in the _busybox function is:
>
>  _cmd_variant[${words[1]}]=busybox _normal
>
>That way you can temporarily override what _pick_variant thinks the actual
>variant is. This seems to work quite well, but i did feel some guilt about it,
>since as you mention it's circumventing the interface.

I was playing with this some more to see if i could come up with a better way
and actually discovered a problem with the method i described: it is *not* a
temporary override. Apparently pre-command re-assignment of array members
doesn't work the same way it does with scalars — zsh doesn't put the value back
the way it was when it's done executing the command. I assume the same code is
involved here as with the issue i brought up in workers/42097:

http://www.zsh.org/mla/workers/2017/msg01761.html

Anyway, i suppose i could re-assign or unset it afterwards (according to
whatever the previous state was), but... it sure is starting to feel fragile.

Exporting something to the environment is the natural thing that comes to mind
when i need to communicate with a function that i'm two or three calls removed
from. I guess it could learn about a new scalar? _cmd_variant_override or
something? I don't know. There are lots of ways i could change this to work for
my use case, i just don't want to leave a mess. :/

dana


      reply	other threads:[~2018-01-06  6:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-03 21:29 dana
2018-01-03 23:40 ` Oliver Kiddle
2018-01-04  0:03   ` dana
2018-01-04 11:47     ` Oliver Kiddle
2018-01-04 16:05       ` dana
2018-01-06  6:11         ` dana [this message]

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=909F11B4-7936-47FD-9A2B-F339BD73125F@dana.is \
    --to=dana@dana.is \
    --cc=okiddle@yahoo.co.uk \
    --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).