zsh-workers
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: zsh workers <zsh-workers@zsh.org>
Subject: Re: matcher-list doesn't work with some completers?
Date: Thu, 6 Jan 2011 20:00:04 +0100	[thread overview]
Message-ID: <AANLkTikU-NJY3vy2bKPk79eTWjZWNkVu+T3SiMC4nLby@mail.gmail.com> (raw)
In-Reply-To: <AANLkTi=m-sFf6+uXYV7k17i4rW2r7c0LZB9G4WmL6EfC@mail.gmail.com>

On 6 January 2011 19:42, Mikael Magnusson <mikachu@gmail.com> wrote:
> On 6 January 2011 18:24, Bart Schaefer <schaefer@brasslantern.com> wrote:
>> On Jan 6,  8:41am, Bart Schaefer wrote:
>>>
>>> > ls dir<tab> #works
>>> > du dir<tab> #nothing
>>>
>>> This is a bug in _du, it's returning a 0 status without ever adding any
>>> matches, which causes _dispatch in turn to report success to _complete
>>> which then skips running the matcher-list.
>>>
>>> This in turn is because _du checks for a state transition to handle the
>>> --time and --time-style options, and that case statement masks the
>>> return value from _arguments.
>
> I guess I'll have a go at fixing _mkdir then...

Well, this is not my day. First I had _du in site-functions so nothing
I did fixed it (I figured this out before sending the previous mail).
Then as I was trying to fix _mkdir, I just did a cp **/_mkdir
$fpath[3] to save some time. BUT of course I had -test-3 in that shell
and the new shell had -dev-1 so that copy didn't have any effect. Heh.

Anyway here is a patch for _mkdir:
http://git.mika.l3ib.org/?p=zsh-cvs.git;a=patch;h=80fbf4aa928361bb9f60819c7b8d1922f1732487

Subject: [PATCH] _mkdir: don't set ret=0 when _wanted fails to find any matches

---
 Completion/Unix/Command/_mkdir |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/Completion/Unix/Command/_mkdir b/Completion/Unix/Command/_mkdir
index 927b9df..b5f7519 100644
--- a/Completion/Unix/Command/_mkdir
+++ b/Completion/Unix/Command/_mkdir
@@ -60,9 +60,8 @@ case "$state" in
     if (( $ret )) && [[ ! -prefix - ]] || \
       [[ $variant == zsh && ${#${${words[2,-1]}:#-*}} -gt 0 ]]; then
       _wanted directories expl \
-	'parent directory (alternatively specify name of directory)' \
-	_path_files -/ || _message 'name of directory'
-      ret=0
+        'parent directory (alternatively specify name of directory)' \
+        _path_files -/ && ret=0 || _message 'name of directory'
     fi
     ;;
 esac
-- 
1.7.3


-- 
Mikael Magnusson


      reply	other threads:[~2011-01-06 19:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-06 10:14 Mikael Magnusson
2011-01-06 16:41 ` Bart Schaefer
2011-01-06 17:24   ` Bart Schaefer
2011-01-06 18:42     ` Mikael Magnusson
2011-01-06 19:00       ` Mikael Magnusson [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=AANLkTikU-NJY3vy2bKPk79eTWjZWNkVu+T3SiMC4nLby@mail.gmail.com \
    --to=mikachu@gmail.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).