zsh-users
 help / color / mirror / code / Atom feed
* different kind of glob_complete?
@ 1999-09-03  4:39 Will Day
  1999-09-03  5:25 ` Bart Schaefer
  0 siblings, 1 reply; 8+ messages in thread
From: Will Day @ 1999-09-03  4:39 UTC (permalink / raw)
  To: zsh users mailing list

[-- Attachment #1: Type: text/plain, Size: 1393 bytes --]

Here's something I've been wondering about - can I get zsh to perform menu
completion of glob patterns that match exactly the end of a string?

For example:

   % zsh -f
   % setopt glob_complete noalwayslastprompt noautolist
   % ls
   file.10  file.11  file.20  file.21
   % vi file*1<^D>
   file.11  file.21
   % vi file*1<TAB>
-> % vi file.11

I'm thinking this would be like glob_complete:

     GLOB_COMPLETE
          When the current word has a glob pattern, do not insert
          all the words resulting from the expansion but generate
          matches as for completion and cycle through  them  like
          MENU_COMPLETE. The matches are generated as if a `*' is
          added to the end of the word or inserted at the  cursor
          if  COMPLETE_IN_WORD  is  set.   Since this doesn't use
          globbing, it works not only for files but for all  com-
          pletions, such as options, user names, etc.

but _without_ the trailing '*'?

-- 
Will Day     <PGP mail preferred>     OIT / O&E / Technical Support
willday@rom.oit.gatech.edu            Georgia Tech, Atlanta 30332-0715
  -> Opinions expressed are mine alone and do not reflect OIT policy <-
Those who would give up essential Liberty, to purchase a little temporary
Safety, deserve neither Liberty nor Safety.
    Benjamin Franklin, Pennsylvania Assembly, Nov. 11, 1755

[-- Attachment #2: Type: application/pgp-signature, Size: 344 bytes --]

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

* Re: different kind of glob_complete?
  1999-09-03  4:39 different kind of glob_complete? Will Day
@ 1999-09-03  5:25 ` Bart Schaefer
  0 siblings, 0 replies; 8+ messages in thread
From: Bart Schaefer @ 1999-09-03  5:25 UTC (permalink / raw)
  To: zsh users mailing list

On Sep 3, 12:39am, Will Day wrote:
} Subject: different kind of glob_complete?
}
} Here's something I've been wondering about - can I get zsh to perform menu
} completion of glob patterns that match exactly the end of a string?
} 
} I'm thinking this would be like glob_complete:
} but _without_ the trailing '*'?

This is interesting.  Compare manual entries; here again is 3.1.6:

GLOB_COMPLETE
     When the current word has a glob pattern, do not insert all the
     words resulting from the expansion but generate matches as for
     completion and cycle through them like MENU_COMPLETE. The matches
     are generated as if a `*' is added to the end of the word or
     inserted at the cursor if COMPLETE_IN_WORD is set.  Since this
     doesn't use globbing, it works not only for files but for all
     completions, such as options, user names, etc.

Here is 3.0.6:

GLOB_COMPLETE
     When the current word has a glob pattern, do not insert all the
     words resulting from the expansion but cycle through them like
     `MENU_COMPLETE'.  If no matches are found, a `*' is added to the
                       !!!!!!!!!!!!!!!!!!!!!!!^^^^^^^^^^^^^^^^^^^^^^^
     end of the word, or inserted at the cursor if `COMPLETE_IN_WORD'
     ^^^^^^^^^^^^^^^
     is set, and completion is attempted again.  Using patterns works
     not only for files but for all completions, such as options, user
     names, etc.

I think the 3.1.6 behavior was introduced by Sven in zsh-workers/5871, and
was briefly discussed at that time.  Here's a case where it might differ a
lot from the 3.0.6 behavior, and it sounds as if Will would prefer the old
form -- in fact, he'd prefer that completion were not attempted again when
no matches are found in the first place.

You can certainly get this by some arrangement of the settings for the new
function-based completion system, but I could understand the confusion if
formerly zsh glob-completed file.11 and file.21 but now it glob-completes
filefoo91blather as well.

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


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

* Re: different kind of glob_complete?
@ 1999-09-06  9:13 Sven Wischnowsky
  0 siblings, 0 replies; 8+ messages in thread
From: Sven Wischnowsky @ 1999-09-06  9:13 UTC (permalink / raw)
  To: zsh-users


Will Day wrote:

> A short time ago, at a computer terminal far, far away, Sven Wischnowsky wr=
> ote:
> >And, of course for the new completion system it's already there, just
> >use the `_match' completer with a configuration of `match_original=3Donly'
> >or `match_original=3Dyes'.
> >
> >So, yes, the code in tricky.c can do this now (this was added in
> >5871), but I didn't change the behavior of compctl-style completion.
> >We could add an option to allow this for it, but should we? Or may
> >this be an incentive to go to the new completion system?
> 
> I haven't been keeping up with the discussion about the new completion, so
> I'm not familiar with how it works differently.  Perhaps, indeed, this is a
> good incentive for me to check it out.  As an intro example, how would I go
> about configuring the behavior I was looking for?

You just install the completion system as described at the top of the
`zshcompsys' manual page and after that add this to your .zshrc:

  compconf completer=_complete:_match \
           match_original=yes

which gives the behaviour to first try it without inserting a `*' and
if that fails, it will try completion again with a `*' inserted at the 
cursor position.

This configuration key is desribed at the description for the `_match' 
completer in `zshcompsys'.

Bye
 Sven


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


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

* Re: different kind of glob_complete?
  1999-09-03  7:41 Sven Wischnowsky
  1999-09-03  9:31 ` Bart Schaefer
@ 1999-09-03 17:28 ` Will Day
  1 sibling, 0 replies; 8+ messages in thread
From: Will Day @ 1999-09-03 17:28 UTC (permalink / raw)
  To: zsh users mailing list

[-- Attachment #1: Type: text/plain, Size: 1209 bytes --]

A short time ago, at a computer terminal far, far away, Sven Wischnowsky wrote:
>And, of course for the new completion system it's already there, just
>use the `_match' completer with a configuration of `match_original=only'
>or `match_original=yes'.
>
>So, yes, the code in tricky.c can do this now (this was added in
>5871), but I didn't change the behavior of compctl-style completion.
>We could add an option to allow this for it, but should we? Or may
>this be an incentive to go to the new completion system?

I haven't been keeping up with the discussion about the new completion, so
I'm not familiar with how it works differently.  Perhaps, indeed, this is a
good incentive for me to check it out.  As an intro example, how would I go
about configuring the behavior I was looking for?

-- 
Will Day     <PGP mail preferred>     OIT / O&E / Technical Support
willday@rom.oit.gatech.edu            Georgia Tech, Atlanta 30332-0715
  -> Opinions expressed are mine alone and do not reflect OIT policy <-
Those who would give up essential Liberty, to purchase a little temporary
Safety, deserve neither Liberty nor Safety.
    Benjamin Franklin, Pennsylvania Assembly, Nov. 11, 1755

[-- Attachment #2: Type: application/pgp-signature, Size: 344 bytes --]

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

* Re: different kind of glob_complete?
  1999-09-03  9:31 ` Bart Schaefer
  1999-09-03  9:45   ` Andrej Borsenkow
@ 1999-09-03 14:40   ` Bart Schaefer
  1 sibling, 0 replies; 8+ messages in thread
From: Bart Schaefer @ 1999-09-03 14:40 UTC (permalink / raw)
  To: zsh-users

On Sep 3,  9:31am, Bart Schaefer wrote:
} Subject: Re: different kind of glob_complete?
}
} [...]  even in 3.0.5 the behavior
} is the same as 3.1.6.  So I need to correct the 3.0.6 doc.

I found the 3.1.6 doc slightly confusing, so here's a patch for it, which
matches what I'm putting into the 3.0.6 doc:

Index: Doc/Zsh/options.yo
===================================================================
@@ -389,11 +389,11 @@
 item(tt(GLOB_COMPLETE))(
 When the current word has a glob pattern, do not insert all the words
 resulting from the expansion but generate matches as for completion and
-cycle through them like tt(MENU_COMPLETE). The matches are generated
-as if a `tt(*)' is added to the end of the word or inserted at the cursor if
-tt(COMPLETE_IN_WORD) is set.  Since this doesn't use globbing, it
-works not only for files but for all completions, such as options,
-user names, etc.
+cycle through them like tt(MENU_COMPLETE). The matches are generated as if
+a `tt(*)' was added to the end of the word, or inserted at the cursor when
+tt(COMPLETE_IN_WORD) is set.  This actually uses pattern matching, not
+globbing, so it works not only for files but for any completion, such as
+options, user names, etc.
 )
 pindex(GLOB_DOTS)
 cindex(globbing, of . files)

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


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

* RE: different kind of glob_complete?
  1999-09-03  9:31 ` Bart Schaefer
@ 1999-09-03  9:45   ` Andrej Borsenkow
  1999-09-03 14:40   ` Bart Schaefer
  1 sibling, 0 replies; 8+ messages in thread
From: Andrej Borsenkow @ 1999-09-03  9:45 UTC (permalink / raw)
  To: Bart Schaefer, zsh-users

>
> } We could add an option to allow this for it, but should we?  Or may
> } this be an incentive to go to the new completion system?
>
> Does the setting (or not) of globcomplete have any effect at all on the
> behavior of the new system?
>

Yes. At least to the extent, that with globcomplete menucompletion is started
immediately. Without globcomplete you can use _match and configure it to start
or not to start menucopletion. As I understand, with globcomplete set _match
will never even get a single chance.

/andrej


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

* Re: different kind of glob_complete?
  1999-09-03  7:41 Sven Wischnowsky
@ 1999-09-03  9:31 ` Bart Schaefer
  1999-09-03  9:45   ` Andrej Borsenkow
  1999-09-03 14:40   ` Bart Schaefer
  1999-09-03 17:28 ` Will Day
  1 sibling, 2 replies; 8+ messages in thread
From: Bart Schaefer @ 1999-09-03  9:31 UTC (permalink / raw)
  To: zsh-users

On Sep 3,  9:41am, Sven Wischnowsky wrote:
} Subject: Re: different kind of glob_complete?
}
} Bart Schaefer wrote:
} 
} > I think the 3.1.6 behavior was introduced by Sven in zsh-workers/5871, and
} > was briefly discussed at that time.
} 
} No, the behavior wasn't changed, only the manual was corrected, see
} zsh-workers/5879. I /think/ we once had this (trying it first without
} the `*'), but I don't remember when we lost it.

Hm.  As recently as 5268, you were busy correcting the 3.1.5 manual to more
clearly explain the behavior that the 3.0.6 manual still describes.  That
went into 3.1.5-pws-7.  But I just tried it, and even in 3.0.5 the behavior
is the same as 3.1.6.  So I need to correct the 3.0.6 doc.

It was Andrej's remarks in 5873 that made me blame 5871, but I missed 5875.

} We could add an option to allow this for it, but should we?  Or may
} this be an incentive to go to the new completion system?

Does the setting (or not) of globcomplete have any effect at all on the
behavior of the new system?

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


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

* Re: different kind of glob_complete?
@ 1999-09-03  7:41 Sven Wischnowsky
  1999-09-03  9:31 ` Bart Schaefer
  1999-09-03 17:28 ` Will Day
  0 siblings, 2 replies; 8+ messages in thread
From: Sven Wischnowsky @ 1999-09-03  7:41 UTC (permalink / raw)
  To: zsh-users


Bart Schaefer wrote:

> On Sep 3, 12:39am, Will Day wrote:
> } Subject: different kind of glob_complete?
> }
> } Here's something I've been wondering about - can I get zsh to perform menu
> } completion of glob patterns that match exactly the end of a string?
> } 
> } I'm thinking this would be like glob_complete:
> } but _without_ the trailing '*'?
> 
> This is interesting.  Compare manual entries; here again is 3.1.6:
> 
> [ manuals for 3.0.6 and 3.1.6 being differently ]
> 
> I think the 3.1.6 behavior was introduced by Sven in zsh-workers/5871, and
> was briefly discussed at that time.  Here's a case where it might differ a
> lot from the 3.0.6 behavior, and it sounds as if Will would prefer the old
> form -- in fact, he'd prefer that completion were not attempted again when
> no matches are found in the first place.
> 
> You can certainly get this by some arrangement of the settings for the new
> function-based completion system, but I could understand the confusion if
> formerly zsh glob-completed file.11 and file.21 but now it glob-completes
> filefoo91blather as well.

No, the behavior wasn't changed, only the manual was corrected, see
zsh-workers/5879. I /think/ we once had this (trying it first without
the `*'), but I don't remember when we lost it.

And, of course for the new completion system it's already there, just
use the `_match' completer with a configuration of `match_original=only'
or `match_original=yes'.

So, yes, the code in tricky.c can do this now (this was added in
5871), but I didn't change the behavior of compctl-style completion.
We could add an option to allow this for it, but should we? Or may
this be an incentive to go to the new completion system?

Bye
 Sven


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


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

end of thread, other threads:[~1999-09-06  9:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-09-03  4:39 different kind of glob_complete? Will Day
1999-09-03  5:25 ` Bart Schaefer
1999-09-03  7:41 Sven Wischnowsky
1999-09-03  9:31 ` Bart Schaefer
1999-09-03  9:45   ` Andrej Borsenkow
1999-09-03 14:40   ` Bart Schaefer
1999-09-03 17:28 ` Will Day
1999-09-06  9:13 Sven Wischnowsky

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