zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: <zsh-workers@sunsite.dk>
Subject: Re: Another keep-prefix problem
Date: Thu, 26 Apr 2001 17:18:19 +0000	[thread overview]
Message-ID: <1010426171819.ZM17731@candle.brasslantern.com> (raw)
In-Reply-To: <Pine.LNX.4.30.0104260827080.22014-100000@phong.blorf.net>

} On Thu, 26 Apr 2001, Oliver Kiddle wrote:
} > For _expand I use the glob 1, substitute 1, suffix 1, accept-exact
} > false and tag-order all-expansions styles. keep-prefix changed is
} > the default so that too.
} >
} > To test I did:
} > c1=/home
} > c3=cvs
} > Now,
} > cd $c1/kiddleo/$c3/<tab> expands both $c1 and $c3 which I don't want.

Then as I understand it you don't want `suffix 1' but rather `suffix 0'
and `keep-prefix 1'.

The confusion may be that "suffix" here does not mean "everything after
the rightmost slash".  It means "everything after the LEFTMOST slash."

suffix
     This is used by the _expand completer if the word starts with a
     tilde or parameter expansion. If it is set to `true', the word will
     only be expanded if it doesn't have a suffix, i.e. if it is
                            ^^^^^^^
     something like `~foo' or `$foo', but not if it is `~foo/' or
     `$foo/bar', unless that suffix itself contains characters eligible
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     for expansion.  The default for this style is `true'.


Hmm.  Looking more closely at the code, this is messed up.  It matches
up to the rightmost slash if the string begins with `~', but only up to
the leftmost slash when it begins with a `$', unless all the parameter
references are in `${...}' form, in which case it matches everything
from the lefmost `${' to the rightmost `}' (even if the rightmost `}' is
part of a brace-expansion rather than a parameter-expansion, I think),
as long as there is something after the rightmost `}'.

I spent a while (too long) thinking about how possibly to rewrite this,
but didn't come up with anything helpful.

On Apr 26,  8:43am, Wayne Davison wrote:
}
} Your example would also fail if you just had the $c3 variable (i.e.
} any variable not at the start of the word).  I would like the default
} setting of "suffix 1" to work like the "expand-or-complete" code's
} expander in this regard.

Which means, I think, that you would like the default setting of suffix
to be false rather than true, and the default setting of keep-prefix to
be true rather than "changed".  But I'm not entirely sure of that ...

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


  reply	other threads:[~2001-04-26 17:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-26 14:27 Oliver Kiddle
2001-04-26 15:43 ` Wayne Davison
2001-04-26 17:18   ` Bart Schaefer [this message]
2001-04-26 23:38     ` Wayne Davison
2001-04-27  9:03 ` Sven Wischnowsky
  -- strict thread matches above, loose matches on Subject: below --
2001-04-24  0:46 Wayne Davison
2001-04-24 16:50 ` Bart Schaefer
2001-04-24 19:18   ` Wayne Davison
2001-04-25 13:25     ` Sven Wischnowsky
2001-04-26  4:33       ` 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=1010426171819.ZM17731@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=zsh-workers@sunsite.dk \
    /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).