zsh-workers
 help / color / mirror / code / Atom feed
* prefix-needed style in _popd
@ 2001-03-27  9:22 Oliver Kiddle
  0 siblings, 0 replies; 7+ messages in thread
From: Oliver Kiddle @ 2001-03-27  9:22 UTC (permalink / raw)
  To: zsh-workers

I just noticed that the completion of directory stacks (in _popd but
used also for cd and pushd) doesn't work properly when the
prefix-needed style is set to false. What it does is check the style
and skip the return which normally relies on PREFIX matching [-+]*.
What it doesn't do is complete the initial - or + because those are
normally included in the added matches with ${PREFIX[1]} so we get just
the numbers added as matches.

In this case we could either complete each directory stack entry twice,
preceded by each of - and +, complete only one of those (possibly
selected with a style) or remove support for prefix-needed in _popd. I
basically favour the latter but then I've always had prefix-needed set
true so don't care much. Does anyone else have any opinions or ideas on
this?

Oliver

____________________________________________________________
Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: prefix-needed style in _popd
  2001-03-28  6:22       ` Bart Schaefer
@ 2001-03-28 10:03         ` Peter Stephenson
  0 siblings, 0 replies; 7+ messages in thread
From: Peter Stephenson @ 2001-03-28 10:03 UTC (permalink / raw)
  To: Zsh hackers list

Bart wrote:
> _mh has a lot more specialized knowledge about mh and its subcommands than
> _mailboxes does.  For example, _mh also knows about sequences.  _mailboxes
> just wants to generate all possible matches for other programs that can
> interpret MH mailbox hierarchies.
> 
> Which now makes me think that _mailboxes is doing the right thing, and
> thus that prefix-needed should be tested by callers of _mailboxes rather
> than by _mailboxes itself.

I think that's probably right.  In the case of MH, at the points where
folder names are needed you need either a + or @, almost certainly a + for
most people, and nothing else, so prefix-needed will just be infuriating
(well, I find it always is, but in this case it doesn't have any side
effect of working sometimes).  In other cases, in principle it might be
possible to complete something other than a mailbox if there is no prefix.
I don't think _mailboxes can decide all this easily.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: prefix-needed style in _popd
  2001-03-27 21:16     ` Oliver Kiddle
@ 2001-03-28  6:22       ` Bart Schaefer
  2001-03-28 10:03         ` Peter Stephenson
  0 siblings, 1 reply; 7+ messages in thread
From: Bart Schaefer @ 2001-03-28  6:22 UTC (permalink / raw)
  To: Zsh workers

On Mar 27, 10:16pm, Oliver Kiddle wrote:
} Subject: Re: prefix-needed style in _popd
}
} Bart Schaefer wrote:
} 
} > This is actually what _mailboxes does ... it adds all possible matches,
} > with + or @ or % or full paths or whatever ... I was wondering whether
} > it ought to be testing prefix-needed, too.
} 
} It should really. As should _mh. Also, it seems that _mh acts as if
} prefix-needed is true while _mailboxes acts like it is false. 

_mh has a lot more specialized knowledge about mh and its subcommands than
_mailboxes does.  For example, _mh also knows about sequences.  _mailboxes
just wants to generate all possible matches for other programs that can
interpret MH mailbox hierarchies.

Which now makes me think that _mailboxes is doing the right thing, and
thus that prefix-needed should be tested by callers of _mailboxes rather
than by _mailboxes itself.

Of course, _mutt is the only caller of _mailboxes at the moment, and *that*
behaves as if prefix-needed were true for options but not really for any
mailbox names.

There's also the question of whether it's more common to invoke the mail
commands with the abbreviation form (e.g., `+folder') or by full file
path.  Maybe the completion should show the abbreviated forms by default
and only show file paths when there's a non-empty prefix.

-- 
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   


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: prefix-needed style in _popd
  2001-03-27 17:56   ` Bart Schaefer
@ 2001-03-27 21:16     ` Oliver Kiddle
  2001-03-28  6:22       ` Bart Schaefer
  0 siblings, 1 reply; 7+ messages in thread
From: Oliver Kiddle @ 2001-03-27 21:16 UTC (permalink / raw)
  To: Zsh workers

Bart Schaefer wrote:

> This is actually what _mailboxes does ... it adds all possible matches,
> with + or @ or % or full paths or whatever ... I was wondering whether
> it ought to be testing prefix-needed, too.

It should really. As should _mh. Also, it seems that _mh acts as if
prefix-needed is true while _mailboxes acts like it is false. 

> Sven's patch to _popd makes it behave as if prefix-needed were true
> without actually testing the style any more, whereas _mailboxes behaves
> as if prefix-needed were false.  The inconsistency concerns me (but not
> very much).

We should probably agree on a consistent default for prefix-needed (and
quite possibly other styles). It is already `true' by default for
options which is the most significant thing which prefix-needed affects
so true is going to suprise the least people. On the other hand, there
is the argument that the default should be completeness and the styles
should be used to refine this down to what the user wants.

> I don't set prefix-needed at all, myself, but I don't understand the
> objection to the `false' behavior.  If you're used to typing a prefix,
> then you'll have typed one, and any listing will be restricted to the
> matches that have that prefix.  Is the issue that you don't want to
> see the possible completions that have a prefix when you complete with
> no prefix in the word on the line?

It is exactly what you describe at the end. I consider the completion
system to be as valuable for providing information as for "completing".
I now rarely use ls other than with -l, so I regularly press tab without
first typing a few letters. Without options in the list of completions,
it is often much easier to see what I want. I'm not even convinced that
I like having long options completed unless I first type two minuses.

Completion can be more useful if it is generating fewer matches but is
being intelligent enough to include those things which the user wants
(the fewer things in the list of matches, the less buried the one the
user wants is). I find that with prefix-needed it is more often
successful with this and I find it predictable because I'm used to it
working that way.

Oliver



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: prefix-needed style in _popd
  2001-03-27 11:39 ` Oliver Kiddle
@ 2001-03-27 17:56   ` Bart Schaefer
  2001-03-27 21:16     ` Oliver Kiddle
  0 siblings, 1 reply; 7+ messages in thread
From: Bart Schaefer @ 2001-03-27 17:56 UTC (permalink / raw)
  To: zsh-workers

On Mar 27, 11:42am, Sven Wischnowsky wrote:
}
} Removing the prefix-needed handling is of course the easiest thing
} (and give the behaviour I almost certainly would want and expect,
} too).  For that completeness thing we would have to add every entry
} with `+' and `-'.

This is actually what _mailboxes does ... it adds all possible matches,
with + or @ or % or full paths or whatever ... I was wondering whether
it ought to be testing prefix-needed, too.

Sven's patch to _popd makes it behave as if prefix-needed were true
without actually testing the style any more, whereas _mailboxes behaves
as if prefix-needed were false.  The inconsistency concerns me (but not
very much).

On Mar 27, 12:39pm, Oliver Kiddle wrote:
}
} I just never liked prefix-needed false behaviour. Maybe only because I
} was used to always requiring a prefix going back to all my old tcsh
} completions. One character prefixes are not a lot to type and it is
} nice to cut down the number of matches.

I don't set prefix-needed at all, myself, but I don't understand the
objection to the `false' behavior.  If you're used to typing a prefix,
then you'll have typed one, and any listing will be restricted to the
matches that have that prefix.  Is the issue that you don't want to
see the possible completions that have a prefix when you complete with
no prefix in the word on the line?

-- 
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   


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: prefix-needed style in _popd
  2001-03-27  9:42 Sven Wischnowsky
@ 2001-03-27 11:39 ` Oliver Kiddle
  2001-03-27 17:56   ` Bart Schaefer
  0 siblings, 1 reply; 7+ messages in thread
From: Oliver Kiddle @ 2001-03-27 11:39 UTC (permalink / raw)
  To: zsh-workers

--- Sven Wischnowsky <wischnow@informatik.hu-berlin.de> wrote: > 
> Bleah... I never liked that prefix-needed business.

I just never liked prefix-needed false behaviour. Maybe only because I
was used to always requiring a prefix going back to all my old tcsh
completions. One character prefixes are not a lot to type and it is
nice to cut down the number of matches.

> Hm.  We're here at the core of the zsh-philosophy, aren't we?  Do it

I know what you mean here.

> Removing the prefix-needed handling is of course the easiest thing
> (and give the behaviour I almost certainly would want and expect,
> too).  For that completeness thing we would have to add every entry
> with `+' and `-'.

Personally, I think completeness purely for its own sake is pointless
unless you enjoy implementing it. Can I suggest then that if anyone
feels that completeness here is important or that there is some other
behaviour they want (such as choosing + or -) that they say. Otherwise
we should just remove prefix-needed from _popd so that what is
effectively a bug is gone. 

If anyone does make any significant changes to _popd, can I suggest
that they consider looking at _tilde which could and possibly should
call _popd (especially if _popd is renamed _directory_stack). Currently
it repeats much of _popd.

Oliver

____________________________________________________________
Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: prefix-needed style in _popd
@ 2001-03-27  9:42 Sven Wischnowsky
  2001-03-27 11:39 ` Oliver Kiddle
  0 siblings, 1 reply; 7+ messages in thread
From: Sven Wischnowsky @ 2001-03-27  9:42 UTC (permalink / raw)
  To: zsh-workers


Oliver Kiddle wrote:

> I just noticed that the completion of directory stacks (in _popd but
> used also for cd and pushd) doesn't work properly when the
> prefix-needed style is set to false. What it does is check the style
> and skip the return which normally relies on PREFIX matching [-+]*.
> What it doesn't do is complete the initial - or + because those are
> normally included in the added matches with ${PREFIX[1]} so we get just
> the numbers added as matches.

Bleah... I never liked that prefix-needed business.

> In this case we could either complete each directory stack entry twice,
> preceded by each of - and +, complete only one of those (possibly
> selected with a style) or remove support for prefix-needed in _popd. I
> basically favour the latter but then I've always had prefix-needed set
> true so don't care much. Does anyone else have any opinions or ideas on
> this?

Hm.  We're here at the core of the zsh-philosophy, aren't we?  Do it
in a predictable, complete and consequential way.  Then go back and
make it configurable to allow people to get what they want -- even if
they don't know it yet -- and make the default what most people would
expect or want if they knew.  Or something like that ;-)

Removing the prefix-needed handling is of course the easiest thing
(and give the behaviour I almost certainly would want and expect,
too).  For that completeness thing we would have to add every entry
with `+' and `-'.

In short: I don't know what to do and since I seldom use directory
stack completion, I don't care much about how we decide to do it.
But maybe we should add the matches with the prefix just for
completeness' sake.  Users can always set prefix-needed to false for
the directory-stack tag.

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2001-03-28 10:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-27  9:22 prefix-needed style in _popd Oliver Kiddle
2001-03-27  9:42 Sven Wischnowsky
2001-03-27 11:39 ` Oliver Kiddle
2001-03-27 17:56   ` Bart Schaefer
2001-03-27 21:16     ` Oliver Kiddle
2001-03-28  6:22       ` Bart Schaefer
2001-03-28 10:03         ` Peter Stephenson

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).