zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <opk@zsh.org>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Mikael Magnusson <mikachu@gmail.com>,
	German Riano <griano@yahoo.com>,
	"zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: Re: PATCH: Improve quote handling in _ant completion
Date: Sun, 03 Dec 2023 22:08:48 +0100	[thread overview]
Message-ID: <27223-1701637728.078257@Bkhc.Hp7M.X2jV> (raw)
In-Reply-To: <CAH+w=7bu1nAvXgNfYMve1-HaUrag4C0J05TBGacWDthThQnJCw@mail.gmail.com>

Bart Schaefer wrote:
> On Wed, Nov 29, 2023 at 11:56 AM Mikael Magnusson <mikachu@gmail.com> wrote:
> >
> > >> Also I am proposing to shield 'find_targets' with '((
> > >> $#functions[find_targets] )) ||' so that users can easily override the
> > >> function.
> > >
> > > No particular objection to this, though I wonder if it should be tied
> > > to the "targets" style and _call_program (Oliver?)

You could use _call_program but given that the default in this case
involves two separate invocations of sed and a loop, allowing the
function to be overridden is probably easier for users. I'm not overly
fond of shielding functions that way so tend to only do it for functions
that someone is likely to want to replace. But no objection from me in
this instance. Note that it is more efficient to use (( $+functions[...
and not $#functions[..

It definitely would be best renamed with _ant_ as a prefix. I would just
call it _ant_targets and include the compadd line in the function.
Perhaps whoever wrote it wanted to use it outside of completion. It
could also be rewritten to use fewer subshells.

> > It should probably also be renamed to _ant_find_targets or something
> > similar, it's very unexpected that a completer pollutes the main
> > function namespace.
>
> I've lost track of whether Oliver originally wrote this completer or
> merely committed it, but I'm going to leave this bit unchanged for him
> to weigh in.

I had to consult the git history myself to get the answer to that. And
while I did originally write it, there has been considerable change
since. The original had no separate function for targets. And it's a
long time since I used ant so it's not a completer I've ever had much
reason to look back at. I agree with everything you've said in the
feedback for this patch and haven't replied before because I didn't have
anything useful to add.

Oliver


  reply	other threads:[~2023-12-03 21:09 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <207461559.9336309.1701221332233.ref@mail.yahoo.com>
2023-11-29  1:28 ` German Riano
2023-11-29 19:18   ` Bart Schaefer
2023-11-29 19:19     ` Bart Schaefer
2023-11-29 19:56     ` Mikael Magnusson
2023-11-29 23:44       ` Bart Schaefer
2023-11-30  0:15         ` German Riano
2023-11-30  0:52           ` Bart Schaefer
2023-11-30  1:28             ` German Riano
2023-11-30  2:40               ` Bart Schaefer
2023-12-01 19:20                 ` German Riano
2023-12-02 23:21                   ` Bart Schaefer
2023-12-02 23:31       ` Bart Schaefer
2023-12-03 21:08         ` Oliver Kiddle [this message]
2023-12-04  0:05           ` Bart Schaefer
2023-12-04  0:11             ` Bart Schaefer

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=27223-1701637728.078257@Bkhc.Hp7M.X2jV \
    --to=opk@zsh.org \
    --cc=griano@yahoo.com \
    --cc=mikachu@gmail.com \
    --cc=schaefer@brasslantern.com \
    --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).