zsh-workers
 help / color / mirror / code / Atom feed
* #compdef lines prevent X11 and init.d completion
@ 2010-01-10 17:10 Benjamin R. Haskell
  2010-01-10 18:12 ` Benjamin R. Haskell
  0 siblings, 1 reply; 3+ messages in thread
From: Benjamin R. Haskell @ 2010-01-10 17:10 UTC (permalink / raw)
  To: Zsh Workers

The first line of Completion/X/Utility/_x_arguments is:

#compdef -P */X11(|R[456])/*

It appears the purpose of that line is to grant '-display' and 
'-geometry' arguments to any command residing in those directories.

I frequently use <filename as a command unto itself, happily 
tab-completing the whole of filename.  But, that line prevents me from 
tab-completing into the /etc/X11 and /usr/share/X11 directories.

Similarly, the first line of Completion/Unix/Command/_init_d is:

#compdef -P */(init|rc[0-9S]#).d/*

which prevents completing things in /etc/init.d.

Seems like a bug to me -- not 100% sure where, so I figured I'd ping the 
list before patching it myself.

Thanks,
Ben


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

* Re: #compdef lines prevent X11 and init.d completion
  2010-01-10 17:10 #compdef lines prevent X11 and init.d completion Benjamin R. Haskell
@ 2010-01-10 18:12 ` Benjamin R. Haskell
  2010-01-13 20:28   ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Benjamin R. Haskell @ 2010-01-10 18:12 UTC (permalink / raw)
  To: Zsh Workers

[-- Attachment #1: Type: TEXT/PLAIN, Size: 679 bytes --]

On Sun, 10 Jan 2010, Benjamin R. Haskell wrote:

> [...]
> 
> I frequently use <filename as a command unto itself, happily 
> tab-completing the whole of filename.  But, that line prevents me from 
> tab-completing into the /etc/X11 and /usr/share/X11 directories.
> 
> [...]
> 
> Seems like a bug to me -- not 100% sure where, so I figured I'd ping the 
> list before patching it myself.
> 

Making _redirect consider whether $CURRENT is 1 seems to solve the 
problem for me.  Might also make sense to test whether NULLCMD is set.  
Not sure if this would have other adverse effects, nor what the mention 
of 'ksharrays' in the man page might entail.

Patch attached.

Best,
Ben

[-- Attachment #2: Type: TEXT/PLAIN, Size: 981 bytes --]

Index: Completion/Zsh/Context/_redirect
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Context/_redirect,v
retrieving revision 1.3
diff -u -r1.3 _redirect
--- Completion/Zsh/Context/_redirect	13 Mar 2002 09:28:05 -0000	1.3
+++ Completion/Zsh/Context/_redirect	10 Jan 2010 18:08:50 -0000
@@ -6,11 +6,13 @@
 
 strs=( -default- )
 
-if [[ -n "$_comp_command1" ]]; then
-  strs=( "${_comp_command1}" "$strs[@]" )
-  [[ -n "$_comp_command2" ]] &&
+if [[ "$CURRENT" != "1" ]]; then
+  strs=( "${_comp_command}" "$strs[@]" )
+  if [[ -n "$_comp_command1" ]]; then
+    strs=( "${_comp_command1}" "$strs[@]" )
+    [[ -n "$_comp_command2" ]] &&
       strs=( "${_comp_command2}" "$strs[@]" )
+  fi
 fi
 
-_dispatch -redirect-,${compstate[redirect]},${_comp_command} \
-          -redirect-,{${compstate[redirect]},-default-},${^strs}
+_dispatch -redirect-,{${compstate[redirect]},-default-},${^strs}

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

* Re: #compdef lines prevent X11 and init.d completion
  2010-01-10 18:12 ` Benjamin R. Haskell
@ 2010-01-13 20:28   ` Peter Stephenson
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 2010-01-13 20:28 UTC (permalink / raw)
  To: Zsh Workers

On Sun, 10 Jan 2010 13:12:33 -0500 (EST)
"Benjamin R. Haskell" <zsh@benizi.com> wrote:
> On Sun, 10 Jan 2010, Benjamin R. Haskell wrote:
> > I frequently use <filename as a command unto itself, happily 
> > tab-completing the whole of filename.  But, that line prevents me from 
> > tab-completing into the /etc/X11 and /usr/share/X11 directories.
> 
> Making _redirect consider whether $CURRENT is 1 seems to solve the 
> problem for me.  Might also make sense to test whether NULLCMD is set.  
> Not sure if this would have other adverse effects, nor what the mention 
> of 'ksharrays' in the man page might entail.

I'm not ignoring this, I simply haven't got my mind round what it all
means at the moment.

-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


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

end of thread, other threads:[~2010-01-13 20:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-10 17:10 #compdef lines prevent X11 and init.d completion Benjamin R. Haskell
2010-01-10 18:12 ` Benjamin R. Haskell
2010-01-13 20:28   ` 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).