From: Julien Nicoulaud <julien.nicoulaud@gmail.com>
To: Peter Stephenson <Peter.Stephenson@csr.com>
Cc: zsh-users <zsh-users@zsh.org>
Subject: Re: todo.sh completion
Date: Thu, 25 Nov 2010 21:26:47 +0100 [thread overview]
Message-ID: <AANLkTinvtWi5fwJ4R=QJ3Oh0aUn=8LpWTL5oEvF3WOxR@mail.gmail.com> (raw)
In-Reply-To: <20101125153250.703e1239@pwslap01u.europe.root.pri>
[-- Attachment #1: Type: text/plain, Size: 3717 bytes --]
Thank you for the quick answer and fix Peter ! I just built zsh from sources
and it works fine now. By the way, for users who would want to build Zsh
from sources on Ubuntu(/Debian?), I put the steps here:
http://gist.github.com/715855.
Regards,
Julien
2010/11/25 Peter Stephenson <Peter.Stephenson@csr.com>
> On Thu, 25 Nov 2010 15:34:56 +0100
> Julien Nicoulaud <julien.nicoulaud@gmail.com> wrote:
> > OK, I checked my zshrc and it turns out this was breaking the
> > completion script:
> >
> > autoload -U zsh-mime-setup && zsh-mime-setup
>
> Useful research, thank you.
>
> > I guess this has to do with todo.sh ending with ".sh", since every
> > others completion scripts work fine.
>
> Yes, what should happen is that _zsh-mime-handler finds it shouldn't be
> handling todo.sh in this case and despatching to normal completion
> instead. There were some (at least three) glitches with this. This
> fixes the ones I found.
>
> - zsh-mime-handler didn't handle the "-l" option for stuff it passed
> through without handling. (This should simply end up with $words
> being pruned from the front.)
>
> - _zsh-mime-handler didn't keep empty arguments, which is what
> you get when you first try completion on a word.
>
> - _zsh-mime-handler updated $words but didn't update $CURRENT. Best
> guess is to keep $CURRENT at the same offset from the end of $words.
>
> Index: Completion/Zsh/Function/_zsh-mime-handler
> ===================================================================
> RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Function/_zsh-mime-handler,v
> retrieving revision 1.1
> diff -p -u -r1.1 _zsh-mime-handler
> --- Completion/Zsh/Function/_zsh-mime-handler 23 May 2010 19:54:03 -0000
> 1.1
> +++ Completion/Zsh/Function/_zsh-mime-handler 25 Nov 2010 15:29:27 -0000
> @@ -1,9 +1,19 @@
> #compdef zsh-mime-handler
>
> +# Given that the handler is likely to change the start of the command
> +# line, we'll try to maintain the position from the end of the words
> +# array. Hence for example CURRENT gets decremented by one if the
> +# handler drops off the start.
> +integer end_offset=$(( ${#words} - CURRENT ))
> +
> # zsh-mime-handler -l is supposed to print out the command line
> # with quoting to turn it into a full executable line. So
> # we need to use shell splitting to turn it into words and
> # then unquoting on those words.
> -words=(${(Q)${(z)"$(zsh-mime-handler -l ${words[2,-1]})"}})
> +words=(${(z)"$(zsh-mime-handler -l "${(@)words[2,-1]}")"})
> +# Careful unquoting: we need to keep a '' as a separate word.
> +words=("${(@Q)words}")
> +
> +(( CURRENT = ${#words} - end_offset ))
>
> _normal
> Index: Functions/MIME/zsh-mime-handler
> ===================================================================
> RCS file: /cvsroot/zsh/zsh/Functions/MIME/zsh-mime-handler,v
> retrieving revision 1.13
> diff -p -u -r1.13 zsh-mime-handler
> --- Functions/MIME/zsh-mime-handler 8 Aug 2010 17:20:55 -0000
> 1.13
> +++ Functions/MIME/zsh-mime-handler 25 Nov 2010 15:29:27 -0000
> @@ -144,7 +144,11 @@ if [[ ! -e $1 ]]; then
> fi
> done
> if [[ -z $nonex_ok ]]; then
> - "$@"
> + if (( list )); then
> + print -r -- "${(q)@}"
> + else
> + "$@"
> + fi
> return
> fi
> fi
>
> --
> Peter Stephenson <pws@csr.com> Software Engineer
> Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited
> Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ,
> UK
>
>
> Member of the CSR plc group of companies. CSR plc registered in England and
> Wales, registered number 4187346, registered office Churchill House,
> Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
>
prev parent reply other threads:[~2010-11-25 20:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-25 13:23 Julien Nicoulaud
2010-11-25 13:45 ` Peter Stephenson
2010-11-25 13:55 ` Frank Terbeck
2010-11-25 14:34 ` Julien Nicoulaud
2010-11-25 15:32 ` Peter Stephenson
2010-11-25 20:26 ` Julien Nicoulaud [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='AANLkTinvtWi5fwJ4R=QJ3Oh0aUn=8LpWTL5oEvF3WOxR@mail.gmail.com' \
--to=julien.nicoulaud@gmail.com \
--cc=Peter.Stephenson@csr.com \
--cc=zsh-users@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).