zsh-workers
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: zsh workers <zsh-workers@zsh.org>
Subject: Re: PATCH Re: squeeze-slashes false not working?
Date: Sat, 14 May 2011 20:31:24 +0200	[thread overview]
Message-ID: <BANLkTi=c-dxpE5Dtm-SAEFE8YJRaguc+Tw@mail.gmail.com> (raw)
In-Reply-To: <110513225805.ZM13712@torch.brasslantern.com>

On 14 May 2011 07:58, Bart Schaefer <schaefer@brasslantern.com> wrote:
> On May 13, 10:07pm, Mikael Magnusson wrote:
> }
> } Okay, I'll try to sum up :). Starting from zsh -f + compinit, with
> } path-files on and squeeze-slashes off (the default), I get this
> } behaviour: ls ////<tab> jumps back to the first slash and allows me to
> } complete components in /.
>
> Yep, I get that too.  But once something is completed (e.g. /home///),
> subsequent completions treat the trailing "///" as if it were a
> single slash.  This certainly contradicts the assertion in the doc
> for squeeze-slashes that by default it behaves as if /*/*/.
>
> } With the same and path-files off, it simply behaves as if I had ls
> } /<tab>, ie it completes components in / after the four slashes.
>
> You mean path-completion off, but yes.  In this case it *should* be
> happening this way because

So maybe the squeeze-slashes entry should mention something to the
effect that disabling it will only allow other options to do stuff,
but maybe nothing will. But in a less stupid way.

> } squeeze-slashes on and path-completion on behaves as the second case.
> } squeeze-slashes on and path-completion off behaves the same way.
>
> These are as expected.  Once it has skipped the slashes there's nothing
> for path-completion to act upon.

Right, just wanted to be complete. :)

> } When I type ls /*/*/<tab>, all paths matching that glob are inserted
> } on the command line, this does not equal any of the above results.
>
> Red herring.  Tab is expand-or-complete and as soon as you explicitly
> put in glob characters you're invoking the "expand" instead of the
> "complete".

I retried this with bindkey '^I' complete-word; setopt globcomplete.
With or without your patch, ls /*/*/cit completes to
/home/mikachu/citat and /home/mikachu/citat-private and lets me cycle
between them. Without your patch, ls ///cit completes to /tmp/citat
and /tmp/citat.private. With your patch, ls ///cit acts as /*/*/cit
did, which makes me happy. All of this of course with squeeze-slashes
off and path-completion on.

[snip explainy bits as i have nothing helpful to add]

> So try this; but there may be other places where similar things have
> been missed as this function evolved ...
>
> Index: Completion/Unix/Type/_path_files
> ===================================================================
> RCS file: /extra/cvsroot/zsh/zsh-4.0/Completion/Unix/Type/_path_files,v
> retrieving revision 1.23
> diff -u -r1.23 _path_files
> --- Completion/Unix/Type/_path_files    6 May 2011 15:29:05 -0000       1.23
> +++ Completion/Unix/Type/_path_files    14 May 2011 05:53:20 -0000
> @@ -574,7 +574,7 @@
>     # slash be added.
>
>     tmp1=( ${tmp1//(#b)([][()|*?^#~<>\\=])/\\${match[1]}} )
> -    tmp2="${(M)tpre##((.|..|)/)##}"
> +    tmp2="${(M)tpre##${~skips}}"
>     if [[ -n "$tmp2" ]]; then
>       skipped="/$tmp2"
>       tpre="${tpre#$tmp2}"

This seems to work great in my zsh -f. My next project is working out
why none of this helps with my zshrc loaded :). Thanks.

-- 
Mikael Magnusson


  reply	other threads:[~2011-05-14 18:31 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-12 17:18 Mikael Magnusson
2011-05-13 18:17 ` Peter Stephenson
2011-05-13 18:23   ` Mikael Magnusson
2011-05-13 18:53     ` Peter Stephenson
2011-05-13 20:07       ` Mikael Magnusson
2011-05-14  5:58         ` PATCH " Bart Schaefer
2011-05-14 18:31           ` Mikael Magnusson [this message]
2011-05-14 18:45             ` Mikael Magnusson
2011-05-15  1:38               ` Bart Schaefer
2011-05-15 10:12                 ` Mikael Magnusson
2011-05-15 18:15                   ` Bart Schaefer
2011-05-15 18:20                     ` Mikael Magnusson
2011-05-15  1:39             ` Bart Schaefer
2011-05-15  9:48               ` Mikael Magnusson
2011-05-15 10:01                 ` Mikael Magnusson

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='BANLkTi=c-dxpE5Dtm-SAEFE8YJRaguc+Tw@mail.gmail.com' \
    --to=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).