zsh-workers
 help / color / mirror / code / Atom feed
* The file-sort style is broken
@ 2004-04-27 14:39 Bart Schaefer
  2004-04-27 15:02 ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Bart Schaefer @ 2004-04-27 14:39 UTC (permalink / raw)
  To: zsh-workers

schaefer[512] echo $^fpath/_zip(N)
/usr/share/zsh/4.2.0/functions/_zip
schaefer[513] unzip -<TAB>
No matches for `zip file'

(Huh?  Why is it trying to complete a zip file after a hyphen, rather
than completing options?)

schaefer[513] ls                                                          
editor_1.5.zip     orbit-root/               vmware-root/
fileNEelW2         orbit-schaefer/           vmware-schaefer/
fileaVYCCS         samba/                    zsh30810unzip1
filemmnASt         scrollkeeper-tempfile.0*  zsh31261unzip1
kde-schaefer/      scrollkeeper-tempfile.1*
ksocket-schaefer/  ssh-vmCQ7238/
schaefer[514] unzip <TAB>
No matches for `zip file'

(Well, that's obviously wrong -- there's a .zip file right there.  I try
it with "zsh -f" and it works.  OK, start deleting my zstyles, one by
one ... a few commands later ...)

schaefer[516] zstyle -d ':completion:*' file-sort modification
schaefer[517] unzip -<TAB>
Completing option
-C   -- match filenames case-insensitively
(etc. etc.)
schaefer[517] unzip <TAB>
Completing zip file
editor_1.5.zip     orbit-root/        ssh-vmCQ7238/                       
kde-schaefer/      orbit-schaefer/    vmware-root/                        
ksocket-schaefer/  samba/             vmware-schaefer/

Here's a snippet from the _complete_debug output:

: _path_files:126:then else for elif-then; tmp2=( '(#i)*.(zip|[ejw]ar)(om#q-.)' )

See where the "om" has been inserted?  Bad, very bad.  However, that does
not explain why completing options doesn't work, does it?  Or does it?


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

* Re: The file-sort style is broken
  2004-04-27 14:39 The file-sort style is broken Bart Schaefer
@ 2004-04-27 15:02 ` Peter Stephenson
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 2004-04-27 15:02 UTC (permalink / raw)
  To: zsh-workers

Bart Schaefer wrote:
> schaefer[512] echo $^fpath/_zip(N)
> /usr/share/zsh/4.2.0/functions/_zip
> schaefer[513] unzip -<TAB>
> No matches for `zip file'
> 
> (Huh?  Why is it trying to complete a zip file after a hyphen, rather
> than completing options?)

Do you have a matcher style set which assumes `-' is an anchor
character?

> Here's a snippet from the _complete_debug output:
> 
> : _path_files:126:then else for elif-then; tmp2=( '(#i)*.(zip|[ejw]ar)(om#q-.
> )' )
> 
> See where the "om" has been inserted?  Bad, very bad.

How about the following?

Index: Completion/Unix/Type/_path_files
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_path_files,v
retrieving revision 1.23
diff -u -r1.23 _path_files
--- Completion/Unix/Type/_path_files	8 May 2003 10:30:49 -0000	1.23
+++ Completion/Unix/Type/_path_files	27 Apr 2004 15:00:34 -0000
@@ -120,7 +120,9 @@
 
     tmp2=()
     for tmp1 in "$pats[@]"; do
-      if [[ "$tmp1" = (#b)(*[^\$])(\(\([^\|~]##\)\)) ]]; then
+      if [[ "$tmp1" = (#b)(*[^\$])"(#q"(*)")" ]]; then
+	tmp2=( "$tmp2[@]" "${match[1]}(#q${sort}${match[2]})" )
+      elif [[ "$tmp1" = (#b)(*[^\$])(\(\([^\|~]##\)\)) ]]; then
         tmp2=( "$tmp2[@]" "${match[1]}((${sort}${match[2][3,-1]}" )
       elif [[ "$tmp1" = (#b)(*[^\$])(\([^\|~]##\)) ]]; then
         tmp2=( "$tmp2[@]" "${match[1]}(${sort}${match[2][2,-1]}" )

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


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************


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

end of thread, other threads:[~2004-04-27 15:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-27 14:39 The file-sort style is broken Bart Schaefer
2004-04-27 15:02 ` 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).