zsh-workers
 help / color / mirror / code / Atom feed
From: "Karel Balej" <balejk@matfyz.cz>
To: "Bart Schaefer" <schaefer@brasslantern.com>
Cc: <zsh-workers@zsh.org>
Subject: Re: [RFC PATCH 1/2] complete absolute paths for mpc add
Date: Sun, 10 Nov 2024 19:56:43 +0100	[thread overview]
Message-ID: <D5IQ82P71IOB.2WLM65LN09CG5@matfyz.cz> (raw)
In-Reply-To: <CAH+w=7az25SsJsydSC9_aNOJh16DHOqsgpWZ36FYbDUfF_m55Q@mail.gmail.com>

Bart Schaefer, 2024-11-09T11:44:08-08:00:
> I didn't see this the first time around for some reason.
>
> On Fri, Sep 27, 2024 at 9:34 AM Karel Balej <balejk@matfyz.cz> wrote:
> >
> > +(( $+functions[_mpc_helper_all_files] )) ||
> > +_mpc_helper_all_files() {
> > +  if [[ $words[CURRENT] == [/~]* ]]; then
> > +         _files
> > +  fi
> > +  _mpc_helper_files
> > +}
>
> If _files succeeds ($? == 0) but _mpc_helper_files fails ($? != 0)
> then _mpc_helper_all_files will appear to fail and completion will
> proceed to the next possible alternative.
>
> Does something like the following still give the result you expect?
>
> _mpc_helper_all_files() {
>   local ret=1
>   if [[ $words[CURRENT] == [/~]* ]]; then
>          _files
>          ret=$?
>   fi
>   _mpc_helper_files || return ret
> }

Thank you, this seems to give me the same results as the original,
however I don't immediately see any difference in behaviour even when I
force _mpc_helper_files to fail -- the _files results are still
completed even without the ret handling. Or do I just misunderstand how
this should work?

Again, I might misunderstand how this "next possible alternative"
mechanism works, however it occurred to me whether it might be possible
and possibly simpler to just have _mpc_helper_files fail on no matches
and have the completion fall back to _files only then?

Best regards,
K. B.


  reply	other threads:[~2024-11-10 18:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-27 16:31 Karel Balej
2024-09-27 16:31 ` [RFC PATCH 2/2] enable completion for mpc insert Karel Balej
2024-11-09 15:21 ` [RFC PATCH 1/2] complete absolute paths for mpc add Karel Balej
2024-11-09 19:44 ` Bart Schaefer
2024-11-10 18:56   ` Karel Balej [this message]
2024-11-10 23:10     ` Bart Schaefer
2024-11-11 19:26       ` Karel Balej
2024-11-12  2:52         ` 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=D5IQ82P71IOB.2WLM65LN09CG5@matfyz.cz \
    --to=balejk@matfyz.cz \
    --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).